Set with set -x, clear with set +x; cluster letters (set -ex) or use the
name (set -o xtrace). set -o alone lists them, set +o prints them as
commands, and $- holds the letters in effect.
Letter
Name
Effect
-a
allexport
Every assignment is exported
-b
notify
Accepted; background job status is reported at the prompt
-C
noclobber
> does not overwrite an existing file (`>
-e
errexit
Exit when a command fails
-f
noglob
No pathname expansion
-h
Accepted; commands are remembered as they run
-m
monitor
Job control
-n
noexec
Read and parse commands without running them (not at the prompt)
-u
nounset
Expanding an unset variable is an error
-v
verbose
Print input lines as they are read
-x
xtrace
Print each command, after expansion, before it runs (PS4 is the prefix)
nolog
Keep commands out of the history
nonlexicalctrl
break and continue reach loops in calling functions
emacs
Emacs-style line editing (the default)
vi
Vi-style modal line editing; set -o vi turns emacs off and back
hash’s own set name=value options (prompt, colors, welcome, PS1, color.<element>,
syntax_highlight, autosuggest, danger_highlight) are listed on the
configuration page.
The Built-in Commands page has the full entry for each, the text help NAME prints; this table is the one-line form. Every builtin takes -- as the end of its options.
Command
Synopsis and meaning
:
: [arg...]: do nothing, status 0
., source
. file, source file: run a file in the current shell
[, test
[ expr ], test expr: evaluate an expression (Test Command)
[[
[[ expr ]]: extended test, with ==/!= patterns, =~ regular expressions, && and || inside
alias
alias [name[=value]...]: define or print aliases
bg
bg [%job]: continue a stopped job in the background
break
break [n]: leave n enclosing loops
cd
cd [-L|-P] [dir]: change directory; -L (default) keeps the logical path, -P resolves symlinks, cd - goes back
command
command name [arg...], command -v | -V name...: run a command without function lookup; -v/-V show how a name resolves