⇤ ← Revision 1 as of 2023-01-29 05:27:32
Size: 2575
Comment:
|
Size: 2581
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 13: | Line 13: |
If `noglob` is enabled, [[Bash/Expansion#Filename_Expansion|filename expansion]] is not applied. | If `noglob` is enabled, [[Shell/Expansion#Filename_Expansion|filename expansion]] is not applied. |
Line 84: | Line 84: |
* The test command(s) in `while` or `until` [[Bash/Looping|loops]] * The test command(s) in `if` [[Bash/Logic|conditional logic]] |
* The test command(s) in `while` or `until` [[Shell/Looping|loops]] * The test command(s) in `if` [[Shell/Logic|conditional logic]] |
Line 87: | Line 87: |
* [[Bash/Expansion#Command_Expansion|Command substitutions]] * Any command in a [[Bash/Pipeline|pipeline]] except the last |
* [[Shell/Expansion#Command_Expansion|Command substitutions]] * Any command in a [[Shell/Pipeline|pipeline]] except the last |
Line 128: | Line 128: |
If `xtrace` is enabled, simple commands as well as [[Bash/Looping|looping commands]] (and all arguments to these commands) are printed before execution. | If `xtrace` is enabled, simple commands as well as [[Shell/Looping|looping commands]] (and all arguments to these commands) are printed before execution. |
Bash Shell Options
The shell can be configured with the set and unset builtins. To inspect the enabled options, use the $SHELLOPTS shell variable.
Contents
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:
The test command(s) in while or until loops
The test command(s) in if conditional logic
Any command followed by && or ||, or preceded by !
Any command in a 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 looping commands (and all arguments to these commands) are printed before execution.
set -x #or: set -o xtrace set +x