## B.6. Options

These are options that can be turned on with the set -o command. All are initially off except where noted. Abbreviations, where listed, are options to set that can be used instead of the full set -o command (e.g., `set -a` is an abbreviation for `set -o allexport`). For the most part, the abbreviations are actually backward-compatible Bourne shell options. To disable an option, use set +o long-name or set +X, where long-name and X are the long form or the single character form of the option, respectively.

Option | Abbrev | Meaning
--- | --- | ---
allexport | `-a` | Export all subsequently defined variables.
bgnice |  | Run all background jobs at decreased priority (on by default).
emacs |  | Use Emacs-style command-line editing.
errexit | `-e` | Exit the shell when a command exits with nonzero status.
gmacs |  | Use Emacs-style command-line editing, but with a slightly different meaning for CTRL-T (See Chapter 2).
ignoreeof |  | Disallow CTRL-D to exit the shell.
keyword | `-k` | Execute assignments in the middle of command lines. (Very obsolete.)
markdirs |  | Add / to all directory names generated from wildcard expansion.
monitor | `-m` | Enable job control (on by default).
noclobber | `-C` | Don't allow `>` redirection to existing files.
noexec | `-n` | Read commands and check for syntax errors, but don't execute them.
noglob | `-f` | Disable wildcard expansion.
nolog |  | Disable command history for function definitions.
notify | `-b` | Print job completion messages right away, instead of waiting for next prompt.
nounset | `-u` | Treat undefined variables as errors, not as null.
pipefail |  | Wait for all jobs in a pipeline to complete. Exit status is that of last command that failed, or zero otherwise. (ksh93g and later.)
privileged | `-p` | Script is running in suid mode.
trackall | `-h` | Create an alias for each full pathname found in a command search. (ksh93 ignores this option; the behavior is always on, even if this option is turned off.)
verbose | `-v` | Print commands (verbatim) before running them.
vi |  | Use vi-style command-line editing.
viraw |  | Use vi-mode and have each keystroke take effect immediately. (This is required on some very old systems for vi-mode to work at all, and is necessary on all systems in order to use TAB for completion. Starting with ksh93n, it is automatically enabled when vi-mode is being used.)
xtrace | `-x` | Print commands (after expansions) before running them.

The set command has a few additional options that don't have corresponding set -o versions, as follows:

Option | Meaning
--- | ---
`set -A` ... | Indexed array assignment.
`set -s` | Sort the positional parameters.
`set -t` | Read and execute one command, and then exit. (Obsolete.)

Copyright © 2003 O'Reilly & Associates. All rights reserved.