snippetbashTip
set — Toggle shell options or set the values of positional parameters. More information: <https://www.gnu.
Viewed 0 times
theshellcommandoptionsclisettoggle
Problem
How to use the
set command: Toggle shell options or set the values of positional parameters. More information: <https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin>.Solution
set — Toggle shell options or set the values of positional parameters. More information: <https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin>.Display the names and values of shell variables:
setExport newly initialized variables to child processes:
set -aWrite formatted messages to
stderr when jobs finish:set -bWrite and edit text in the command-line with
vi-like keybindings (e.g. yy):set -o viReturn to default (
emacs) mode:set -o emacsList all modes:
set -oExit the shell when (some) command fails:
set -eReset all shell parameters and assign new ones:
set -- {{argument1 argument2 ...}}Code Snippets
Display the names and values of shell variables
setExport newly initialized variables to child processes
set -aWrite formatted messages to `stderr` when jobs finish
set -bWrite and edit text in the command-line with `vi`-like keybindings (e.g. `yy`)
set -o viReturn to default (`emacs`) mode
set -o emacsContext
tldr-pages: common/set
Revisions (0)
No revisions yet.