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 earlier section "Invoking the Shell.”)
Arguments are assigned in order to $1
, $2
, etc.
Options
There is a large set of overlapping options amongst ksh88, ksh93, and Bash. To minimize confusion, the following list includes every option. The table provided after the list summarizes which options are available in which shells.
-
-a
From now on automatically mark variables for export after defining or changing them.
-
+A
name
Assign remaining arguments as elements of array name. Korn shell only.
-
-A
name
Same as
+A
, but unset name before making assignments. Korn shell only.-
-b
Print job completion messages as soon as jobs terminate; don’t wait until the next prompt. Not ksh88.
-
-B
Enable brace expansion. On by default. Bash only.
-
-C
Prevent overwriting via
>
redirection; use>|
to overwrite files. Not ksh88.-
-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. Bash only.-
-f
Ignore filename metacharacters (e.g.,
* ? [ ]
).-
-G
Cause
**
to also match subdirectories during filename expansion. ksh93 only.-
-h
Locate commands as they are defined. The Korn shell creates tracked aliases, whereas Bash hashes command names. On by ...
Get Unix in a Nutshell, 4th 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.