set - set shell options and positional parameters.
set [+-abCefhmnuvx] [+-o option] [argument ...] set -o set +o set -- [argument ...]
set is a POSIX special builtin provided by Rush. A - option enables a setting and the corresponding + option disables it. Remaining operands replace the positional parameters. set -- clears them when no operands follow.
With no operands, set prints shell variables. set -o prints named option states, while set +o prints reusable commands that reproduce the current named option settings.
| Short | Named | Effect |
|---|---|---|
-a | allexport | Export variables assigned afterward. |
-b | notify | Report completed background jobs without waiting for the next prompt. |
-C | noclobber | Prevent ordinary output redirections from replacing existing regular files. |
| - | emacs | Use Emacs-style interactive line editing. On by default; mutually exclusive with vi. |
-e | errexit | Exit after an untested command failure. |
-f | noglob | Disable pathname expansion. |
-h | hashall | Remember command paths as commands are found. |
-m | - | Enable job control. |
-n | noexec | Read commands without executing them. |
| - | pipefail | Use the rightmost non-zero pipeline status, or zero if all commands succeed. |
-u | nounset | Treat expansion of unset parameters as an error where required by the shell language. |
-v | verbose | Write shell input as it is read. |
| - | vi | Use POSIX vi interactive line editing. Mutually exclusive with emacs. |
-x | xtrace | Trace expanded commands before execution. |
Use set -o name or set +o name to enable or disable a named option. Short options may be combined.
emacs is Rush's default interactive editing mode and an implementation extension: POSIX.1-2024 does not standardize shell Emacs bindings. set -o vi enables vi mode and disables emacs; set +o vi restores the default Emacs-style option. set +o emacs clears the explicit Emacs option without enabling vi.
Zero on success and two for invalid options or option names.
rush-builtins(7), POSIX Shell Command Language.