z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Using special parameters in commands and shell scripts

z/OS UNIX System Services User's Guide
SA23-2279-00

The z/OS® shell has a variety of special parameters that may be used in command lines and shell scripts.

Parameter Expands to
$@ The complete list of positional parameters, each separated by a single space. If $@ is quoted, the separate arguments are each quoted; for example:
echo "$@"
is equivalent to:
"$1" "$2" "$3"
If the positional parameters are all file names:
cp $@ dir
copies all the files to the given directory dir.
$* The complete list of positional parameters. If $* is quoted, the result is concatenated into a single argument, with parameters separated by the first character of the value of the shell variable IFS. For example, if the first character of IFS is a comma, then:
echo "$*"
displays the parameters with separating commas:
"$1,$2,$3"
$# The number of positional parameters passed to this shell script. This number can be changed by several shell commands (for example, set or shift); see z/OS UNIX System Services Command Reference.
$? The exit status value returned by the most recently run command. The command echo $? prints out the status from the most recently run operation or command.
$– The set of options that have been specified for this shell session. This includes options that were specified on the command line that started the shell, plus other options that have been set with the set command.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014