set

set KornShell flags and positional parameters

KornShell Built-in


SYNOPSIS

set [±abCefhiKkmnpstuvx-] [±Aname] [±[ flag]] [parameter ...]


DESCRIPTION

Calling set without arguments displays the names and values of all KornShell variables, sorted by name, in the following format:
Variable="value"
The quoting allows the output to be re-input to the shell using the built-in command eval.

Options

Arguments of the form -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.
Note:

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.

For interactive shells, these settings may be automatically loaded from the Registry.
+A name

assigns the parameter list to the elements of name, starting at name[0].

-A name

unsets 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 flag

sets 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
same as -a option.
errexit
same as -e option.
bgnice
runs background jobs at a lower priority.
emacs
specifies emacs style in-line editor for command entry.
gmacs
specifies gmacs style in-line editor for command entry.
ignoreeof
tells shell not to exit on end-of-file.
interactive
same as -i option
keyword
same as -k option.
korn
same as -K option
logical
specifies that cd, pwd, and the PWD variable use logical pathnames in directories with symbolic links. If this flag is not set, these built-ins and PWD use physical directory pathnames. For example, assume /usr/spool is a symbolic link to /var/spool and that it is your current directory. If logical is not set, PWD has the value /var/spool, and cd .. changes the current directory to /var. If logical is set, PWD has the value /usr/spool and cd .. changes the current directory to /usr.
login
same as -L option of sh.
markdirs
adds trailing / to directory names when generating using wild card characters.
monitor
same as -m option.
noclobber
same as -C option.
noerrorbells
turns off the error bell.
noexec
same as -n option.
noglob
same as -f option.
nolog
does not record function definitions in the history file.
noposixpids
on systems where there is an alternative method of displaying process IDs, the KornShell parameters $$ and $! are displayed using this method.
notify
same as -b option.
nounset
same as -u option.
privileged
same as -p option.
tabcomplete
changes the <tab> character into a file name completion character. This flag only works when using the vi, emacs, or gmacs editing modes.
trackall
same as -h option.
verbose
same as -v option.
vi
specifies vi style in-line editor for command entry.
xtrace
same as -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.


DIAGNOSTICS

Possible exit status values are:
0

Successful completion.

1

Invalid command line argument.

2

Failure resulting in a usage message, usually due to a missing argument.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0.

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.


NOTE

This is a special built-in command of the MKS KornShell.


SEE ALSO

Commands:
export, typeset


Updated MKS Toolkit [3khat16.ico]HP3000 [3khat16.ico]3kMail [archive16.gif]