Go to the previous, next section.
The shell is the system's user interface. It allows you, the user, to enter commands which the system then performs. When the system is initialised a special shell, called the system shell is created.
Each shell simply loops reading commands until it is told to exit, each time a command is required the current prompt is printed to the tty and a line of input is read from the same tty (see section The TTY Device Driver).
Once a whole line has been read it is split into words, each of which is separated by a sequence of white-space characters (either spaces or tabs). To create a word which contains spaces it can be bracketed by two single-quote (`'') characters. If the first non-white space character in a line is a hash character (`#') the line is treated as a comment and ignored.
After tokenising its input line the shell uses the first word in the line to identify the command being invoked. It uses this word to search the table of available commands, if a match is found the action associated with this command is performed, using the remaining words in the command line as parameters.
The system is not restricted to only one shell; the shell
shell
command and the hot key Alt-ESC both create a new shell
process, running in a new tty.
A shell script is a file containing lines of shell commands.
This file can then be executed by the shell as though each line in the
file had been entered by hand. The only difference is that no prompt
is printed before each line. To execute a shell script use the
source
command.
Execute in order the lines of the file called file-name. A
synonym for this command is .
.
To allow you to configure the system to your needs two special shell scripts can exist,
To help you use the system the shell and its commands provide a
simple online help system. Each command provides a short
string documenting itself. The help
shell command then uses
these strings to provide short pieces of help information.
This command implements the shell's online help system. Invoking the command with no parameter prints a list of the available commands to the shell's tty.
When given, the command-name parameter should name a shell command, its documentation string is searched for and if it exists it will be printed to the tty.
This section describes some of the other available shell commands. Note that these are only the commands provided by the shell. Commands provided by other modules of the system are documented with the rest of that module.
Prints each member of args to the tty, followed by a newline character.
Set the string printed before each line in this shell to prompt.
Terminate the current shell.
Clear the screen of the current shell and move the cursor to its top-left corner.
Spawn a new sub-shell in a new tty.
Copies the following lines typed at the shell's tty to the file called dest-file. The original contents of the file are discarded. End the process by typing an end-of-file character (Ctrl-d).
Go to the previous, next section.