options arg1 arg2 ...]
With no arguments, set prints the values of all variables
known to the current shell. Options can be enabled
option) or disabled (+
Options can also be set when the shell is invoked, via ksh or sh.
(See "Invoking the Shell" at the end of this section.)
Arguments are assigned in order to $1, $2, etc.
Assign remaining arguments as elements of array
Same as +A, but unset
name before making assignments.
Korn shell only.
From now on, automatically mark variables for export after defining or changing them.
Exit if a command yields a nonzero exit status. In the Korn shell, the ERR trap is issued before the command exits.
Ignore filename metacharacters (e.g.,
* ? [ ]).
Locate commands as they are defined. The Korn shell creates tracked aliases, whereas the Bourne shell hashes function names. See hash.
Assignment of environment variables (
will take effect regardless of where they appear on the
command line. Normally, assignments must follow the command name.
Enable job control; background jobs will execute in a separate process group. -m is usually set automatically. Korn shell only.
Read commands but don't execute; useful for checking errors.
List Korn shell modes, or turn on mode
Many modes can be set by other options. Modes are:
Same as -a.
Run background jobs at lower priority.
Set command-line editor to emacs.
Same as -e.
EOF signals. To exit the shell, type exit.
Same as -k.
Append / to directory names.
Same as -m.
Prevent overwriting via
> redirection; use
>| to overwrite files.
Same as -n.
Same as -f.
Omit function definitions from history file.
Same as -u.
Same as -p.
Same as -h.
Same as -v.
Set command-line editor to vi.
Same as vi, but process each character when it's typed.
Same as -x.
Start up as a privileged user (i.e., don't process $HOME/.profile).
Sort the positional parameters. Korn shell only.
Exit after one command is executed.
In substitutions, treat unset variables as errors.
Show each shell command line when read.
Show commands and arguments when executed, preceded by a
This provides step-by-step debugging of shell scripts.
(Same as -o xtrace.)
Turn off -v and -x, and turn off option processing. Included in Korn shell for compatibility with older versions of Bourne shell.
Used as the last option; -- turns off option processing so that arguments beginning with - are not misinterpreted as options. (For example, you can set $1 to -1.) If no arguments are given after --, unset the positional parameters.
set - "$num" -20 -30 Set
$3to -30. set -vx Read each command line; show it; execute it; show it again (with arguments). set +x Stop command tracing. set -o noclobber Prevent file overwriting. set +o noclobber Allow file overwriting again.