10.0;sh (shell), revision 1.0, 88/04/22
sh (shell) -- Invoke a Shell (command line interpreter).
usage: sh [pathname [arg ...]] (or) sh [
[-b[on] | -boff | -nb[on]]
[-e[on] | -eoff | -ne[on]]
[-v[on] | -voff | -nv[on]]
[-x[on] | -xoff | -nx[on]]
[ [ -f[irst] ] -c[ommand] arg1... ]
[-i[nter] | -s[cript] | -ni[nter]]
[-n[execute] | -ex[ecute]]
[-p[rompt]1 prompt_string]
[-p[rompt]2 prompt_string]
[-start [file] | -nstart]
[pathname [arg ...]] ]
DESCRIPTION
The shell has four types of commands:
External Commands
These are programs that reside on your disk. They are invoked when
you type in their pathname or, if their directories are included in
your command search rules, when you type their leafname.
Internal Commands
These are built-in shell commands (see below). The shell always
looks for these first.
Control Structures
These are programming constructs that allow you to control the flow
of control in a shell script. Note: Since these structures are
legal anywhere on the command line, you must enclose them in
quotation marks when using the help command (for example, help
'if').
Expressions
These are delimited by '((' and '))'. Inside of these double
parentheses you can set variables, compare values and perform other
standard integer, string or Boolean operations. The assignment
operation (variable := value) is a special case that does not have
to be enclosed in double parentheses.
Any of these commands can have its output redirected or may be invoked in
the background using the shell's parsing operators (>, >>, >?, >>? <, <<,
<?, <<?, |, &...) See Using Your Aegis Environment for details.
Internal Commands
Flags
von, voff, xon, xoff, bon, boff, eon, eoff
Variables
readc, read, readln, existvar, lvar, dlvar, setvar, export
Control Structures
if, while, select, for@* eqs, existf, return, exit, next, source, set,
abtsev, not
Miscellaneous
args, csr, rdym, hlpver, inlib, umask
Expressions
true, false@* :=, or, and, =, <, >, <=, >=, <>, +, =, *, /, mod, **, (,
), not
ARGUMENTS
pathname (optional)
Specify a file containing a shell script to be executed.
Each line in the file is interpreted as a shell command.
Default if omitted: read standard input
args (optional)
Specify any arguments to be passed to the program in file
pathname. Arguments are substituted for ^n expressions in
the program: arg1 for ^1, arg2 for ^2, etc. ^* can be
used to specify all the arguments at once. (See the
manual, Using Your Aegis Environment for details on
passing arguments to shell commands.) See example 1
below.
Default if omitted: no arguments passed
OPTIONS
-b[on] Send the output of a background process (created with the &
parsing operator) to the display. The output of the
background process is displayed in the transcript pad of the
shell where it was invoked. If you do not specify -b, the
output of the background process is sent to /dev/null.
-boff (default)
Do not display output from a background process.
-nb[on] (default)
Same as -boff.
-c[ommand] arg1 ...
Execute the following argument(s) as a shell command, exactly
as if it had been read as an input line. If any argument
contains explicit blanks, enclose it in quotation marks. The
shell passes all text following -c to arg1 as arguments, so
if you want to specify other options to the sh command
itself, they must precede -c.
If arg1 is the name of a shell script, note that the script
creates a new shell level for execution (just as if you had
invoked it at the $ prompt). Thus activities in the script
that are level-dependent (such as assigning values to shell
variables) do not propagate upward when the script exits.
This is in contrast to the -start option and the shell
command source, which execute scripts at the current shell
level.
-e[on] Enable evaluation of variables outside of expressions. If -e
is specified, the shell always evaluates variables,
regardless of the context in which they appear. If -e is not
specified, variables are evaluated only inside variable
expression delimiters, ((expression)); otherwise, the shell
treats the ^var_name expressions as strings and they are not
evaluated.
-eoff (default)
Evaluate variables only inside expressions.
-ne[on] (default)
Same as -eoff.
-f[irst]) Do not exit after executing the command given by the -c
option. This option is valid only if -c has been specified,
and must precede -c on the command line.
-i[nter]) Behave as though input is being entered interactively: prompt
for each input line, and do not exit on errors or quit faults
(the Display Manager dq command or CTRL/Q from keyboard).
Normally, the shell executes interactively only if its input
comes from a pad or SIO line. Use of this option forces
prompting.
-s[cript] (default)
Behave as though executing a shell script: do not prompt and
abort on error. A shell does not normally quit; any error or
quit command is assumed to apply only to the last command
given to the shell.
-ni[nter] (default)
Same as -s.
-n[execute] Interpret each command line only; suppress execution.
-ex[ecute] (default)
Interpret each command line and execute it.
-p[rompt]1 prompt_string
Define the prompt string for the shell created with sh.
-p[rompt]2 subprompt_string
Define the subprompt string for the shell created with sh.
(The subprompt appears when you continue a shell command over
more than one line).
-start [file]
Execute the specified script after the shell is created. If
file is not specified, the shell searches the log-in home
directory for a file called user_data/sh/startup and executes
it if it exists. No error occurs if that file does not
exist.
Note that the script is executed at the current shell level,
so that level-dependent activities (such as assigning values
to shell variables) persist when the script exits. This is in
contrast to the -c option, which executes scripts at the next
lower shell level.
This option is a default if sh is the first program invoked
in a new process (i.e., cp /com/sh). It is not a default at
any other time (i.e., when you type sh at the dollar sign or
call it from a script).
-nstart Disable start-up file execution.
-v[on] Display each line of text in the transcript pad as it is read
by the shell program.
-voff (default)
Disable input verification.
-nv[on] (default)
Same as -voff.
-x[on] Display each command in the transcript pad immediately before
execution. Each command is given in full, with its complete
pathname and with the values of arguments inserted.
-xoff (default)
Disable input examination.
-nx[on] (default)
Same as -xoff.
EXAMPLES
$ sh program-name arg1 arg2 ...
The shell executes the commands in the file program-name, and substitutes
the arguments (argn) for character sequences ^n in the program file.
$ sh -n my_script
Interpret each line in my_script, but do not execute anything.
SEE ALSO
More information is available. Type
shell For general information about the shell
shell commands For an index of shell commands
shell i_o For a description of the shell input/output redirection
operators