Table of Contents

Bash - Set (of Bash Options)

About

The set builtin command can be specify shell option.

When options are specified, they set or unset shell attributes.

Syntax

set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

Without options, the name and value of each shell variable are displayed in a format that can be reused as input for setting or resetting the currently-set variables.

Read-only variables cannot be reset.

In posix mode, only shell variables are listed.

The output is sorted according to the current locale.

When options are specified, they set or unset shell attributes.

Any arguments remaining after the options are processed are treated as values for the positional parameters and are assigned, in order, to 1, 2, … n.

Options, if specified, have the following meanings:

The options are off by default unless otherwise noted. Using + rather than - causes these options to be turned off. The options can also be specified as arguments to an invocation of the shell.

List

The current set of options may be found in $-.

Return Status

The return status is always true unless an invalid option is encountered.

Option-Name

The option-name can be one of the following: