set [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 (+option). Options can also be set when the shell is invoked. (See the earlier section "Invoking the Shell.”) Arguments are assigned in order to $1, $2, etc.


There is a large set of overlapping options amongst ksh88, ksh93, and Bash. To minimize confusion, the following list includes every option. The table provided after the list summarizes which options are available in which shells.


From now on automatically mark variables for export after defining or changing them.

+A name

Assign remaining arguments as elements of array name. Korn shell only.

-A name

Same as +A, but unset name before making assignments. Korn shell only.


Print job completion messages as soon as jobs terminate; don’t wait until the next prompt. Not ksh88.


Enable brace expansion. On by default. Bash only.


Prevent overwriting via > redirection; use >| to overwrite files. Not ksh88.


Exit if a command yields a nonzero exit status. The ERR trap executes before the shell exits.


Cause shell functions, command substitutions, and subshells to inherit the ERR trap. Bash only.


Ignore filename metacharacters (e.g., * ? [ ]).


Cause ** to also match subdirectories during filename expansion. ksh93 only.


Locate commands as they are defined. The Korn shell creates tracked aliases, whereas Bash hashes command names. On by ...

Get Unix in a Nutshell, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.