setset KornShell flags and positional parameters |
KornShell Built-in |
set
[±abCefhiKkmnpstuvx-
]
[±A
name]
[±
[ flag]]
[parameter ...]
set
without arguments displays the names and
values of all KornShell variables, sorted by name, in the following format:
The quoting allows the output to be re-input to the shell using the built-in commandVariable="value"
eval
.
-
option set each
KornShell flag specified as an option.
Similarly, arguments of the form +
option
turn off each of the KornShell flags specified as an option.
All of the set
options except
±A
, -s
,
-
, and --
are
shell flags. KornShell flags can also be set on the
sh
command line at
invocation.
+A
nameassigns the parameter list to the elements of name, starting at name[0].
-A
nameunsets name, then assigns the parameter list to the elements of name starting at name[0].
-a
sets all subsequently defined variables for export.
-b
notifies you when background jobs finish running.
-C
prevents the output redirection operator >
from
overwriting an existing file. Use the alternate operator >|
to force an overwrite.
-e
tells a non-interactive shell to execute the ERR
trap and then
exit, whenever a simple command returns a non-zero exit.
This flag is disabled when reading profiles.
-f
disables path name expansion.
-h
makes all commands use tracked aliases. (See
sh
for an explanation of tracked
aliases.)
-i
makes the shell interactive.
-K
tells the shell to use Korn-compatible behavior in any case where the
POSIX.2 behavior is different from the behavior specified by Korn. In
particular, this affects the
trap
command.
-k
allows assignment parameters anywhere on the command line and still includes them in the environment of the command.
-L
makes the shell a login shell. Setting this flag is effective only at shell invocation.
-m
runs each background job in a separate process group and reports on each (to standard error) as they complete.
-n
tells a non-interactive shell to read commands but not execute them.
±o
flagsets the specified shell flag. If you do not specify flag, this option lists all shell flags which are currently set. flag can be one of the following:
allexport
-a
option.errexit
-e
option.bgnice
emacs
emacs
style in-line editor for command
entry.gmacs
gmacs
style in-line editor for command
entry.ignoreeof
interactive
-i
optionkeyword
-k
option.korn
-K
optionlogical
login
-L
option of sh
.markdirs
/
to directory names when generating using
wild card characters.monitor
-m
option.noclobber
-C
option.noerrorbells
noexec
-n
option.noglob
-f
option.nolog
noposixpids
$$
and $!
are
displayed using this method.notify
-b
option.nounset
-u
option.privileged
-p
option.tabcomplete
vi
,
emacs
, or gmacs
editing modes.trackall
-h
option.verbose
-v
option.vi
vi
style in-line editor for command
entry.xtrace
-x
option.See shedit
for a
description of the effect of setting options emacs
,
gmacs
, or vi
.
-p
resets PATH
variable to default value,
disables processing of HOME/.profile
and uses file /etc/suid_profile
instead of the file in the ENV
variable.
-s
sorts the positional parameters.
-t
exits after reading and executing one command.
-u
tells the shell to give an error message if an unset parameter is used in a substitution.
-v
prints shell input lines as they are read.
-x
prints commands and their arguments as they execute.
-
turns off -v
and -x
flags. Also,
parameters which follow this option do not set shell flags, but are
assigned to positional parameters (see
sh
).
--
parameters which follow this option do not set shell flags, but are assigned to positional parameters.
0
Successful completion.
1
Invalid command line argument.
2
Failure resulting in a usage message, usually due to a missing argument.
set
is a built-in command of the Bourne Shell and
KornShell on UNIX.
The Bourne shell only has the -a
, -e
,
-h
, -k
, -n
,
-t
, -u
, -v
, and
-x
flags.
The shell flags ±A
, ±h
,
±i
, -K
,
±k
, ±p
,
-s
, ±t
,
bgnice
, emacs
, gmacs
,
guierror
, interactive
,
keyword
, korn
,
logical
, login
,
markdirs
, noerrorbell
,
nolog
, privileged
,
tabcomplete
, and trackall
are extensions to the POSIX and XPG standards.
Of these extensions, ±A
, ±h
,
±p
, -s
, ±t
,
bgnice
, emacs
, gmacs
,
keyword
, markdirs
,
nolog
, privileged
, and
trackall
are found in the KornShell.