![]() |
Retro Rocket OS
|
rocketsh is the interactive shell used to execute commands and run programs. It is launched by init at boot and is always available at the system prompt.
This page describes rocketsh in detail. For a simple overview of using the shell, see The Shell in the User Guide.
The rocketsh shell supports command line editing. You may use the cursor LEFT and RIGHT keys plus HOME and END to navigate in the current line and edit it, inserting into the line if neccessary.
Alternately, you can use the cursor UP and DOWN keys to move through the history of recently entered commands. If you edit one of these commands or send it, it will be inserted into the history again as the latest command.
The history buffer will grow as needed to accomodate as many history items as you enter.
Pressing ESC will abort the current line entry, clearing its contents and advancing down to the line below.
These interactive line editing facilities are also available to any other BASIC programs via the ansi library.
The rocketsh shell supports two forms of input; firstly any command you type is searched for as a program under the /programs directory. If it can be found it is executed. The path under which rocketsh searches for programs to run can be changed, as shown below.
If no matching program can be found, the line is passed to EVAL instead and any changes to the program state will be inherited by rocketsh, including documented variables below.
Any line entered at the prompt which is not resolved to a program is executed using EVAL.
This means the shell accepts full BASIC syntax directly at the prompt, including:
All built-in BASIC keywords, operators, and functions are available exactly as they are within a BASIC program.
Single-line input executes in the current shell context.
Multi-line input (see below) executes as an anonymous child program.
Changes made by single-line execution persist in the shell environment.
rocketsh supports entering and executing multi-line BASIC programs directly at the prompt.
The entered lines are combined and executed using EVAL as an anonymous program.
Change the current working directory.
Move to the parent directory (one level up).
For example, if you are in /programs/tools, up will take you to /programs.
Run a program from the directory set in PATH$.
This runs the program named myprog from the current program search path.
Run a program from PATH$ in the background.
The program starts and runs independently, allowing you to continue using the shell.
Display version and copyright information for the shell.
Save the current working directory on a stack, then optionally change directory.
Restore the most recently saved directory from the stack.
Shows all directories pushed to the stack with push and pop
Show which program will be executed for any given command using PATH$ to resolve it. PATH$ is walked from left to right.
Show all commands stored in the command history, which you may retrieve with the cursor keys.
The rocketsh shell allows you to change certain variables that influence how the shell operates. These are:
The PATH$ variable is a list of directories that are searched for programs to run them. Each path in PATH$ (separated by semicolons, ';') is prepended to the command line to try and match a file. If a match is found by prepending this search path, the program is executed. So for example if your program is located at /programs/tasks/foo and you type tasks/foo, with the path containing /programs, the program will be found and ran. Note this is slightly different from how paths operate in other operating systems. The current directory cannot be included in the path as it has no direct representation.
If you want to run a program that is not in the path, you must provide the full path to the program from the file system root.
This is the path where system libraries may be found. There can be only one active library path. Programs may optionally use this global variable when loading their libraries, but it is not mandatory to do so, for example if a program wishes to load its own libraries from some non-standard location.
Changing the PROMPT$ variable changes the displayed prompt of the shell to whatever you want. By default, PROMPT$ has the value "ROCKETSH". Changing PROMPT$ to an empty string will cause it to display just >, like the BBC Micro.
You should not directly change the CSD$ variable. This shows the CSD, or 'Currently Selected Directory'.