= Shell Options = The shell can be configured with the `set` and `unset` [[Shell/BuiltinCommands#Set|builtins]]. To inspect the enabled options, use the `$SHELLOPTS` [[Shell/ShellVariables#Not_Useful|shell variable]]. <> ---- == Expansion == If `noglob` is enabled, [[Shell/Expansion#Filename_Expansion|filename expansion]] is not applied. {{{ set -f #or: set -o noglob set +f }}} ---- == Interactive Shells == If `vi` is enabled, [[Vim|vi]]-style cursor movement commands can be used on the command prompt. {{{ set -o vi }}} If `notify` is enabled, the status of terminated background jobs is printed immediately, as opposed to before printing the next prompt. {{{ set -b #or: set -o notify set +b }}} If `ignoreeof` is enabled, an interactive shell will not exit upon receipt of an `EOF` character. {{{ set -o ignoreeof }}} ---- == Job Control == If `monitor` is enabled, job control (i.e. background processes) is used. {{{ set -m #or: set -o monitor set +m }}} ---- == Programming == If `verbose` is enabled, commands are printed before executing. {{{ set -v #or: set -o verbose set +v }}} If `allexport` is enabled, all variables that are created or modified are set to export. {{{ set -a #or: set -o allexport set +a }}} === Errors === If `errexit` is enabled, a command returning an error code will cause the shell to exit in most circumstances. The exceptions are: * The test command(s) in `while` or `until` [[Shell/Looping|loops]] * The test command(s) in `if` [[Shell/Logic|conditional logic]] * Any command followed by `&&` or `||`, or preceded by `!` * [[Shell/Expansion#Command_Expansion|Command substitutions]] * Any command in a [[Shell/Pipeline|pipeline]] except the last {{{ set -e #or: set -o errexit set +e }}} If `nounset` is enabled, accessing an unset variable raises an error. {{{ set -u #or: set -o nounset set +u }}} If `noclobber` is enabled, output redirection with `>`, `>&`, and `<>` will raise an error rather than overwrite a file. {{{ set -C #or: set -o noclobber set +C }}} ---- == Testing == If `noexec` is enabled, no commands will be executed. {{{ set -n #or: set -o noexec set +n }}} ---- == Tracing == If `xtrace` is enabled, simple commands as well as [[Shell/Looping|looping commands]] (and all arguments to these commands) are printed before execution. {{{ set -x #or: set -o xtrace set +x }}} ---- CategoryRicottone