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.

-G 

always writes shell errors to standard error and turns off all GUI features for the running shell. If this option is specified, it overrides set -o guierror.

-h 

makes all commands use tracked aliases. (See sh for an explanation of tracked aliases.)

This option is on by default when the shell is in bash mode and off by default, otherwise.

-i 

makes the shell interactive.

-K 

tells the shell to use Korn-compatible behavior in any case where that behavior differs from the shell's default behavior. In particular, this affects the trap command. Also, the built-in time utility is disabled; however, the external version is still available.

-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.

bash 

tells the shell to use Bourn-Again Shell (bash) behavior in any case where that behavior differs from the shell's default behavior. (See the sh reference page for details on differences between bash, ksh sh.)

bgnice 

runs background jobs at a lower priority.

cmdcomplete 

turns on command completion in the shell.

This option is turned on by default when the shell is in bash mode and turned off by default in ksh mode and the default sh.

criterror 

same as -X option.

dotglob 

specifies that wild card patterns will match file names that start with the . character during file name generation.

By default, this option is off and wild card patterns will not match file names that start with the . character.

emacs 

specifies emacs style in-line editor for command entry.

errexit 

same as -e option.

esccomplete 

lets the ESCESC key combination behave the same as ESC\ changes the ESC character into a file name completion character. This flag only works when using the vi, emacs, or gmacs editing modes.

gmacs 

specifies gmacs style in-line editor for command entry.

guierror 

displays shell errors in a Windows message box.

hashall 

same as -h option.

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 

has no effect on Windows systems.

login 

same as -L option of sh.

markdirs 

adds trailing / to directory names when generating using wild card characters.

monitor 

same as -m option.

no_empty_cmd_completion 

prevents command completion from occurring when no characters have yet been typed.

This option is off by default.

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 (for example, Windows 95/98/Me displayed $$ and $! in hexadecimal).

notify 

same as -b option.

nounset 

same as -u option.

onecmd 

same as -t option.

physical 

same as -P option.

posix 

turns on certain specific 'pedantic posix' behavior. For example, in 'pedantic posix' mode, variables defined on a command line before a command are set in current the shell as well as in the subshell used to run the command.

privileged 

same as -p option.

restricted_shell 

is set when you start the shell in restricted mode (see the description of the -r option in the sh reference page). The value may not be changed. The shell does not reset this option when the startup file are executed, allowign the startup files to discover whether or not a shell is restricted.

tabcomplete 

changes the <tab> character into a file name completion character. This flag only works when using the vi, emacs, or gmacs editing modes.

This option is turned on by default when the shell is in bash mode and turned off by default in ksh mode and the default sh.

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 the Command Line Editing section of the sh reference page for a description of the effect of setting options emacs, gmacs, or vi.

-P 

uses the physical directory structure instead of symbolic links when executing commands such as cd that change the current directory. By default, the shell follows the logical chain of directories when executing such commands.

Note:

Symbolic links are only available on 8.1/2012R2/2016/2019/2022 systems with the NTFS file system.

-p 

resets PATH variable to default value, disables processing of HOME/.profile (HOME/profile.ksh on Windows systems) and uses file ROOTDIR/etc/suid_profile ($ROOTDIR/etc/suid_pro.ksh on Windows systems) 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 

displays shell input lines as they are read.

-X 

enables critical error handling. Normally, critical errors cause system calls to fail without any user intervention. This applies to both the shell and most programs run from the shell. Setting this option causes the shell to prompt you for an action, in the same manner as cmd.exe does.

-x 

displays 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. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

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. The set command supplied with PTC MKS Toolkit should not be confused with the set command internal to cmd.exe.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
chacl, lsacl, registry

Using the MKS KornShell


PTC MKS Toolkit 10.4 Documentation Build 39.