set - Set or unset options and positional parameters
Synopsis
set [ -abCefFjlmntuvx- ] [
-o option ] [ argument ... ]
set [ +abCefFjlmntuvx- ] [
+o option ] [ argument ... ]
Description
The set utility can:
- Display the names and values of all shell variables by
specifying no options or arguments.
- Display the option settings by specifying the
-o option but no option.
- Set an option by specifying a - (minus)
followed by the option letter or by specifying -o
option.
- Unset an option by specifying a + (plus)
followed by the option letter or by specifying +o
option.
- Set positional parameters by specifying
arguments.
- Unset positional parameters by specifying --
but no argument.
Options
All of the single letter options have a corresponding
-o option. The option value is listed in
parenthesis following the letter option below. qsh
supports the following options:
- -a (allexport)
- Set the export attribute to each variable that is assigned a
value.
- -b (notify)
- Enable asynchronous notification of background job
completion.
- -C (noclobber)
- Do not overwrite existing files with the >
redirection operator.
- -e (errexit)
- If the interactive option is not set, exit immediately if any
untested command fails. The exit status of a command is considered
to be explicitly tested if the command is used to control an
if, elif, while,
or until; or if the command is the left hand
operand of an && or ||
operator.
- -f (noglob)
- Disable path name expansion.
- -F (float)
- Enable floating point arithmetic in arithmetic
expressions.
- -j (jobtrace)
- Enable job tracing. Each time qsh starts a
i5/OS(TM) job, it displays a message to standard error with the
fully-qualified job name and process id.
- -l
(logcmds)
- Enable command logging. Write each command to a message in the job
log before it is run.
- -m (monitor)
- Display a message when a job completes. qsh
implicitly turns on this option when the interactive option is
set.
- -n (noexec)
- If the interactive option is not set, read commands but do not
run them. This is useful for checking the syntax of shell
scripts.
- -t (trace)
- Enable internal tracing. qsh traces internal
information to the file specified by TRACEFILE
variable or the qsh_trace file in the user's home directory.
- -u (nounset)
- Write a message to standard error when attempting to expand a
variable that is not set, and if the interactive option is not set
exit immediately.
- -v (verbose)
- Write input to standard error as it is read.
- -x (xtrace)
- Write each command to standard error before it is run, preceded
by the expansion of the PS4 variable.
Operands
Each argument is assigned in order to the positional
parameters.
Exit Status
Related information
Examples
- List all variables and their values:
set
- List all option settings:
set -o
- Set positional parameters $1, $2, $3:
set alpha beta gamma
- Set the allexport and notify options:
set -o allexport -o notify
- Set the verbose and xtrace options:
set -xv
- Unset the xtrace option:
set +x
- Unset the notify option:
set +o notify
- Unset all positional parameters:
set --