Name

set

Synopsis

set [options arg1 arg2 ...]

With no arguments, set prints the values of all variables known to the current shell. Options can be enabled (-option) or disabled (+option). Options can also be set when the shell is invoked. (See the section Invoking the Shell in Invoking the Shell.) Arguments are assigned in order to $1, $2, etc.

Options

-a

From now on, automatically mark variables for export after defining or changing them.

-b

Print job completion messages as soon as jobs terminate; don’t wait until the next prompt.

-B

Enable brace expansion. On by default.

-C

Prevent overwriting via > redirection; use >| to overwrite files.

-e

Exit if a command yields a nonzero exit status. The ERR trap executes before the shell exits.

-E

Cause shell functions, command substitutions, and subshells to inherit the ERR trap.

-f

Ignore filename metacharacters (e.g., * ? [ ]).

-h

Locate and remember commands as they are defined. On by default.

-H

Enable csh-style (!-style) history substitution. On by default.

-k

Assignment of environment variables (var=value) takes effect regardless of where they appear on the command line. Normally, assignments must precede the command name.

-m

Enable job control; background jobs execute in a separate process group. -m is usually on by default.

-n

Read commands but don’t execute; useful for checking syntax. Ignored if the shell is interactive.

+o [mode]

With mode, disable the given shell option. Plain set +o prints the settings of all the current options in a form that can be reread ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.