Shell Options

The shell can be configured with the set and unset builtins. To inspect the enabled options, use the $SHELLOPTS shell variable.


Expansion

If noglob is enabled, filename expansion is not applied.

set -f #or: set -o noglob
set +f


Interactive Shells

If vi is enabled, 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:

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 looping commands (and all arguments to these commands) are printed before execution.

set -x #or: set -o xtrace
set +x


CategoryRicottone

Shell/ShellOptions (last edited 2023-01-29 05:28:34 by DominicRicottone)