HP-UX Reference (11i v1 00/12) - 1 User Commands N-Z (vol 2)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/neqn.1
________________________________________________________________
___ ___
s
sh-bourne(1) sh-bourne(1)
NAME
sh, rsh - Bourne shell, the standard/restricted command programming language
SYNOPSIS
sh [- -acefhiknrstuvx ...] [arg ...]
rsh [- -acefhiknrstuvx ...] [arg ...]
DESCRIPTION
sh is a command programming language that executes commands read from a terminal or a file. rsh is
a restricted version of the standard command interpreter sh; it is used to set up login names and execution
environments whose capabilitiesare more controlled than those of the standard shell. See ‘‘Invocation’’ and
‘‘Special Commands’’ sections later in this entry for details about command line options and arguments,
particularly the set command.
Definitions
A blank is a tab or a space character. A name is a sequence of letters, digits, or underscores beginning
with a letter or underscore. A parameter is a name, a digit, or any of the characters *, @, #, ?, -, $, and
!.
Commands
A simple-command is a sequence of non-blank words separated by blanks. The first word specifies the
name of the command to be executed. Except as specified below, the remaining words are passed as argu-
ments to the invoked command. The command name is passed as argument 0 (see exec(2)). The value of a
simple-command is its exit status if it terminates normally, or (octal) 200+status if it terminates abnor-
mally (see signal(5) for a list of status values).
A pipeline is a sequence of one or more commands separated by
| (or, for historical compatibility, by
ˆ).
The standard output of each command except the last is connected by a pipe(2) to the standard input of the
next command. Each command is run as a separate process and the shell waits for the last command to
terminate. The exit status of a pipeline is the exit status of the last command.
A list is a sequence of one or more pipelines separated by
;, &, &&,or
||, and optionally terminated by ;
or &. Of these four symbols, ; and & have equal precedence, which is lower than that of
&& and ||.
The symbols
&& and || also have equal precedence. A semicolon (;) causes sequential execution of the
preceding pipeline; an ampersand (
&) causes asynchronous execution of the preceding pipeline (i.e., the
shell does not wait for that pipeline to finish). The symbol && (||) causes the list following it to be exe-
cuted only if the preceding pipeline returns a zero (non-zero) exit status. An arbitrary number of new-line
characters instead of semicolons can appear in a list to delimit commands.
A command is either a simple-command or one of the following. Unless otherwise stated, the value
returned by a command is that of the last simple-command executed in the command.
for name [ in word ... ] do list done
Each time a
for command is executed, name is set to the next word taken from the in
word list. If in word ... is omitted, the for command executes the do list once for each
positional parameter that is set (see Parameter Substitution below). Execution ends when
there are no more words in the list.
case word in [pattern [|pattern] ... ) list ;; ] ... esac
A
case command executes the list associated with the first pattern that matches word.
The form of the patterns is the Pattern Matching Notation as qualified for the
case com-
mand (see regexp(5)).
if list then list [elif list then list] ... [else list] fi
The list following
if is executed and, if it returns a zero exit status, the list following the
first then is executed. Otherwise, the list following elif is executed and, if its value is
zero, the list following the next then is executed. Failing that, the else list is executed.
If no else list or then list is executed, the if command returns a zero exit status.
while list do list done
A while command repeatedly executes the while list and, if the exit status of the last
command in the list is zero, executes the do list; otherwise the loop terminates. If no
commands in the do list are executed, the while command returns a zero exit status;
until can be used in place of while to negate the loop termination test.
HP-UX Release 11i: December 2000 − 1 − Section 1−−835
___
___