8.0;sh (shell), revision 8.0, 84/04/20
SH (SHELL) -- Invoke a Shell (command line interpreter).
usage: SH [(-B|-V|-N|-X|-C|-S|-F|-E|-P1 string|-P2 string)...]
[pathname [arg ...]]
FORMAT
SH [options] [pathname [arg ...]]
SH is the command line interpreter. It reads lines from standard input or
from shell programs; interprets them, finding the commands to which they refer
and the arguments for the commands; and then invokes the commands. Note that
SH does NOT create a process; it is only a program that runs inside a
pre-existing process. To start a process (which may then run a Shell or any
other program), see HELP CP.
ARGUMENTS
pathname
(optional) Specify file containing a Shell script to be executed. Each
line in the file will be 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. (See the
DOMAIN System Command Reference Manual for details on
passing arguments to Shell commands.) See example 1.
below.
Default if omitted: no arguments passed.
OPTIONS
-B 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.
-C 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 quotes.
-F Do not exit after executing the command given by the -C
option. This option is valid only if -C has been
specified.
-I Behave as though input is being entered interactively:
prompt for each input line, and do not exit on errors or
quit faults (DQ or CTRL/Q from keyboard). Normally, SH
examines the program being run to see whether or not
interactive prompting is appropriate. Use of this option
forces prompting.
-N Interpret each command line only; suppress execution.
-P1 prompt_string
Define the prompt string for the Shell created with SH.
-P2 subprompt_string
Define the subpromt string for the Shell created with SH.
(The subprompt appears when you continue a Shell command
over more than one line).
-S Behave as though executing a Shell script: do not prompt
and abort on error. A Shell normally will not quit; any
error or quit command is assumed to apply only to the last
command given to the Shell.
-V Display each line of text in the transcript pad as it is
read by the Shell program.
-X 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.
-E 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 delimeters, ((expression)); otherwise, the Shell
treats the ^var_name expressions as strings and they are
not evaluated.
EXAMPLES
1. $ 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.
2. $ sh -n my_script Interpret each line in 'my_script',
but do not execute anything.
SUMMARY OF SHELL SYNTAX
cmds ->
[ pipe ] { ';' [ pipe ] | '&' [ pipe ] }
pipe ->
scmd { '|' scmd }
scmd ->
'(' cmds ')' { redir }
| 'if' scmd 'then' cmds 'else' cmds 'endif'
| 'while' scmd 'do' cmds 'enddo'
| cmd { redir | arg | '(' { arg } ')' }
redir ->
<file | >file | <?file | >?file | <<! | <<?!
cmd ->
command | shell_program
Note: everything after an unquoted, unescaped # on a line
is treated as a comment.