incomplete - text, examples, maybe extended description
set [--abefhkmnptuvxBCHP] <-o OPTIONNAME> [-][--] <POSPARAMS>
set is primarily made to
Without any options,
set displays all shell- and environment-variables (only is POSIX-mode) in a re-usable format
All attributes below can be switched on using
-X and switched off using
+X. This is done because of the historical meaning of the
- to set flags (true for most commands on UNIX®).
|Automatically mark new and altered variables to be exported to subsequent environments.|
|Don't wait for the next prompt to print when showing the reports for a terminated background job (only with job control)|
|When set, the shell exits when a simple command in a command list exits non-zero (
|Disable pathname expansion (globbing)|
|Remembers the location of commands when they're called (hashing). Enabled by default.|
|Allows to place environment-assignments everywhere in the commandline, not only infront of the called command.|
|Monitor mode. With job control, a short descriptive line is printed when a backgroud job ends. Default is "on" for interactive shells (with job control).|
|Read and parse but do not execute commands - useful for checking scripts for syntax errors. Ignored by interactive shells.|
|Set/unset attributes with long option names, e.g.
|Turn on privileged mode.|
|Exit after reading and executing one command.|
|Treat unset variables as an error when performing parameter expansion. Non-interactive shells exit on this error.|
|Print shell input lines as they are read - useful for debugging.|
|Print commands just before execution - with all expansions and substitutions done, and words marked - useful for debugging.|
|The shell performs brace expansion This is on by default.|
|Don't overwrite files on redirection operations. You can override that by specifying the
|Don't follow symlinks when changing directories - use the physical filesystem structure.|
|"End of options" - all following arguments are assigned to the positional parameters, even when they begin with a dash.
|If no arguments follow, the positional parameters are unset. With arguments, the positional parameters are set, even if the strings begin with a
|Long options usable with
|Use an emacs-style command line editing interface. This is enabled by default when the shell is interactive, unless the shell is started with
|If set, command historization is done (enabled by default on interactive shells)|
|The effect is as if the shell command
|If set, the exit code from a pipeline is different from the normal ("last command in pipeline") behaviour:
|When set, Bash runs in POSIX mode.|
Tag a part of a shell script to output debugging information (
#!/bin/bash ... set -x # on ... set +x # off ...
set and its basic behaviour and options are specified by POSIX®. However, options that influence Bash-specific things are not portable, naturally.