Go to the first, previous, next, last section, table of contents.
This builtin is so complicated that it deserves its own section.
set
-
set [--abefhkmnptuvxBCHP] [-o option] [argument ...]
If no options or arguments are supplied, set
displays the names
and values of all shell variables and functions, sorted according to the
current locale, in a format that may be reused as input.
When options are supplied, they set or unset shell attributes.
Options, if specified, have the following meanings:
-a
-
Mark variables which are modified or created for export.
-b
-
Cause the status of terminated background jobs to be reported
immediately, rather than before printing the next primary prompt.
-e
-
Exit immediately if a simple command (see section Simple Commands) exits
with a non-zero status, unless the command that fails is part of an
until
or while
loop, part of an if
statement,
part of a &&
or ||
list, or if the command's return
status is being inverted using !
.
-f
-
Disable file name generation (globbing).
-h
-
Locate and remember (hash) commands as they are looked up for execution.
This option is enabled by default.
-k
-
All arguments in the form of assignment statements are placed
in the environment for a command, not just those that precede
the command name.
-m
-
Job control is enabled (see section Job Control).
-n
-
Read commands but do not execute them; this may be used to check a
script for syntax errors.
This option is ignored by interactive shells.
-o option-name
-
Set the option corresponding to option-name:
allexport
-
Same as
-a
.
braceexpand
-
Same as
-B
.
emacs
-
Use an
emacs
-style line editing interface (see section Command Line Editing).
errexit
-
Same as
-e
.
hashall
-
Same as
-h
.
histexpand
-
Same as
-H
.
history
-
Enable command history, as described in section Bash History Facilities.
This option is on by default in interactive shells.
ignoreeof
-
An interactive shell will not exit upon reading EOF.
keyword
-
Same as
-k
.
monitor
-
Same as
-m
.
noclobber
-
Same as
-C
.
noexec
-
Same as
-n
.
noglob
-
Same as
-f
.
notify
-
Same as
-b
.
nounset
-
Same as
-u
.
onecmd
-
Same as
-t
.
physical
-
Same as
-P
.
posix
-
Change the behavior of Bash where the default operation differs
from the POSIX 1003.2 standard to match the standard
(see section Bash POSIX Mode).
This is intended to make Bash behave as a strict superset of that
standard.
privileged
-
Same as
-p
.
verbose
-
Same as
-v
.
vi
-
Use a
vi
-style line editing interface.
xtrace
-
Same as
-x
.
-p
-
Turn on privileged mode.
In this mode, the
$BASH_ENV
and $ENV
files are not
processed, shell functions are not inherited from the environment,
and the SHELLOPTS
variable, if it appears in the environment,
is ignored.
This is enabled automatically
on startup if the effective user (group) id is not equal to the real
user (group) id. Turning this option off causes the effective user
and group ids to be set to the real user and group ids.
-t
-
Exit after reading and executing one command.
-u
-
Treat unset variables as an error when performing parameter expansion.
An error message will be written to the standard error, and a non-interactive
shell will exit.
-v
-
Print shell input lines as they are read.
-x
-
Print a trace of simple commands and their arguments after they are
expanded and before they are executed.
-B
-
The shell will perform brace expansion (see section Brace Expansion).
This option is on by default.
-C
-
Prevent output redirection using `>', `>&', and `<>'
from overwriting existing files.
-H
-
Enable `!' style history substitution (see section History Expansion).
This option is on by default for interactive shells.
-P
-
If set, do not follow symbolic links when performing commands such as
cd
which change the current directory. The physical directory
is used instead. By default, Bash follows
the logical chain of directories when performing commands
which change the current directory.
For example, if `/usr/sys' is a symbolic link to `/usr/local/sys'
then:
$ cd /usr/sys; echo $PWD
/usr/sys
$ cd ..; pwd
/usr
If set -P
is on, then:
$ cd /usr/sys; echo $PWD
/usr/local/sys
$ cd ..; pwd
/usr/local
--
-
If no arguments follow this option, then the positional parameters are
unset. Otherwise, the positional parameters are set to the
arguments, even if some of them begin with a `-'.
-
-
Signal the end of options, cause all remaining arguments
to be assigned to the positional parameters. The `-x'
and `-v' options are turned off.
If there are no arguments, the positional parameters remain unchanged.
Using `+' rather than `-' causes these options to be
turned off. The options can also be used upon invocation of the
shell. The current set of options may be found in $-
.
The remaining N arguments are positional parameters and are
assigned, in order, to $1
, $2
, ... $N
.
The special parameter #
is set to N.
The return status is always zero unless an invalid option is supplied.
Go to the first, previous, next, last section, table of contents.