set - Set or unset options and positional parameters

Synopsis

set [ -abCefFjlmntuvx- ] [ -o option ] [ argument ... ]

set [ +abCefFjlmntuvx- ] [ +o option ] [ argument ... ]

Description

The set utility can:

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
  1. List all variables and their values:
    set
    
  2. List all option settings:
    set -o
    
  3. Set positional parameters $1, $2, $3:
    set alpha beta gamma
    
  4. Set the allexport and notify options:
    set -o allexport -o notify
    
  5. Set the verbose and xtrace options:
    set -xv
    
  6. Unset the xtrace option:
    set +x
    
  7. Unset the notify option:
    set +o notify
    
  8. Unset all positional parameters:
    set --