MPE/iX Shell and Utilities Reference Manual, Vol 2

sh(1) MPE/iX Shell and Utilities sh(1)
A special parameter is represented with one of the following characters:
*@#?!-$ 0
The values to which special parameters expand are listed later in this section.
Variables are named parameters. For details on naming and declaring variables, see Variables.
The simplest way to use a parameter in a command line is to enter a dollar sign ($) followed
by the name of the parameter. For example, if you enter the command
echo $x
sh replaces $x with the value of the parameter x and then displays the results (because echo
displays its arguments). Other ways to expand parameters are shown later in this section.
Some parameters are built-in to the shell. These are as follows:
$1, $2, ... $9
expands to the dth positional parameter (where d is the single digit following the $.If
there is no such parameter, $d expands to a null string.
$0 expands to the name of the shell, the shell script, or a value assigned when you invoked
the shell.
$# expands to the number of positional parameters.
$@ expands to the complete list of positional parameters. If $@ is quoted, the result is sep-
arate arguments, each quoted. This means that
"$@"
is equivalent to
"$1" "$2" ...
$ expands to the complete list of positional parameters. If $is quoted, the result is con-
catenated into a single argument, with parameters separated by the first character of the
value of
IFS
(see Variables). For example, if the first character of
IFS
is a blank
"$*"
is equivalent to
"$1 $2 ..."
$– expands to all options that are in effect from previous calls to the set(1) command and
from options on the sh command line.
1-530 Commands and Utilities