Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)
User Commands (s) sh(1)
is saved in the REPLY parameter. The list is executed for each selection until a break
or end-of-file character is encountered.
case word in [[(]
pattern [| pattern] ...) list ;;] ... esac" Executes the list associated with the first pattern
that matches word. The form of the patterns is the same as that used for filename gen-
eration. (See Filename Generation.)
if list ;then list [elif list ;then list] ... [;else list] ;fi
Executes the list following if and, if it returns a 0 (zero) exit status, executes the list
following the first then. Otherwise, the list following elif is executed and, if its value is
0 (zero), the list following the next then is executed. Failing that, the else list is exe-
cuted. If no else list or then list is executed, then the if command returns a 0 (zero) exit
status.
while list ;do list ;done
until list ;do list ;done
Executes the while list repeatedly, and if the exit status of the last command in the list
is 0 (zero), executes the do list; otherwise the loop terminates. If no commands in the
do list are executed, then the while command returns a 0 (zero) exit status; until can be
used in place of while to negate the loop termination test.
(list) Executes list in a separate environment. Note that if two adjacent open parentheses are
needed for nesting, a space must be inserted to avoid arithmetic evaluation.
{list;} Executes
list.
Note that unlike the metacharacters ( and ), { and } are reserved words
and must be at the beginning of a line or after a ; (semicolon) in order to be recognized.
[[expression]]
Evaluates expression and returns a 0 (zero) exit status when expression is TRUE. See
Conditional Expressions for a description of expression.
function identifier {list;}
identifier () {list;}
Defines a function that is referenced by identifier. The body of the function is the list
of commands between { and }. (See Functions.)
time pipeline
Executes pipeline and prints the elapsed time as well as the user and system time on
standard error.
The following reserved words are recognized only when they appear, without single or double
quotation marks, as the first word of a command:
case
do
done
elif
else
esac
fi
for
function
if
select
then
527188-021 Hewlett-Packard Company 8−23