From a12d61fb80d6f85aa65048175e2da607983c728e Mon Sep 17 00:00:00 2001 From: Anachronaut Date: Sun, 30 Aug 2026 16:07:44 -0400 Subject: [PATCH] Give the shell an echo, so a script can say what it is doing Say.sbx has printed words since long before there were scripts, and is the wrong shape for one. It is a program: it has to be found on the disk, loaded and started, it prefixes what it was told with "it says:", and the system prints "finished" after it. Three lines of noise around one line of narration, and a load off the disk to produce them. echo is a command, so it costs a comparison. With nothing after it, a blank line - which is what anybody expects and is worth having to space a long script out. Not called "say", although that is the better word. Built-in commands are tried before the disk and always win, so a built-in say would shadow Say.sbx and quietly change what every existing script and test meant by it. Also puts "do" in the help, which the commit that added it forgot, and splits the help text: the new lines pushed it over the assembler's 255 character limit for one string. That failure was hidden for a few minutes by a 'make' whose errors were going to /dev/null - the build kept the disk it already had, and the machine cheerfully reported "I do not know: echo" from a system assembled before echo existed. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW --- Programs/CosmOS/README.md | 8 ++++++++ Programs/CosmOS/Source/cosmos.asm | 30 ++++++++++++++++++++++++++++++ Tests/expected/cosmos.out | 2 ++ Tests/expected/cosmosDeep.out | 2 ++ Tests/expected/cosmosInvoke.out | 2 ++ Tests/expected/cosmosRun.out | 2 +- Tests/expected/cosmosScript.out | 6 +++++- Tests/expected/cosmosSlowDisk.out | 2 +- Tests/expected/cosmosTyped.out | 2 ++ Tests/makedisks.sh | 2 +- 10 files changed, 54 insertions(+), 4 deletions(-) diff --git a/Programs/CosmOS/README.md b/Programs/CosmOS/README.md index 15a917e..9e2d346 100644 --- a/Programs/CosmOS/README.md +++ b/Programs/CosmOS/README.md @@ -125,10 +125,17 @@ line comes from - the shell splits it, matches it and runs it without knowing th ``` #! script ; Build the system and put it where the machine will find it. +echo building CosmOS cd /Source/CosmOS Asm cosmos.asm +echo done ``` +`echo` is a command rather than a program on purpose. `Say.sbx` has printed words since before +there were scripts and is the wrong shape for one: being a program, it has to be found on the +disk and loaded and started, it prefixes what it was told with `it says:`, and the system +prints `finished` after it - three lines of noise around one line of narration. + **The first two bytes must be `#!`**, or the shell refuses the file and says so. That is what tells a script from anything else, and it is deliberately not the name and not a flag in the directory entry: the rule this filesystem keeps is that an entry holds only what the content @@ -176,6 +183,7 @@ CosmOS currently provides these built-in commands: | `load ` | Read and validate an SBEX application, then place its code and data where its header requests. | | `run [words]` | Start the loaded application and make the rest of the line available to it as an argument. | | `do