COHERENT manpages
This page displays the COHERENT manpage for set [Set shell option flags and positional parameters].
List of available manpages
Index
set -- Command
Set shell option flags and positional parameters
set [-ceiknstuvx [name ...] ] (Bourne shell)
set [[+-]aefhkmnuvx] [[+-]o name] (Korn shell)
set changes the options of the current shell and optionally sets the values
of positional parameters. This command is used implemented by both the
Bourne and Korn shells; however, its syntax and options vary from one shell
to the other.
Bourne Shell
The shell variable `$-' contains the currently set shell flags. If the
optional name list is given, set assigns the positional parameters $1, $2
... to the given shell variables.
set recognizes the following options:
-c string
Read shell commands from string.
-e Exit on any error (command not found or command returning nonzero
status) if the shell is not interactive.
-i The shell is interactive, even if the terminal is not attached to it;
print prompt strings. For a shell reading a script, ignore signals
SIGTERM and SIGINT.
-k Place all keyword arguments into the environment. Normally, the shell
places only assignments to variables preceding the command into the
environment.
-n Read commands but do not execute them.
-s Read commands from the standard input and write shell output to the
standard error.
-t Read and execute one command rather than the entire file.
-u If the actual value of a shell variable is blank, report an error rather
than substituting the null string.
-v Print each line as it is read.
-x Print each command and its arguments as it is executed.
- Cancel the -x -v options.
The shell executes set directly.
Korn Shell
set recognizes the following options. Preceding an option with `-' turns
on the option; preceding it with `+' turns it off.
-a allexport: Automatically export all new variables.
-e errexit: Exit from the shell when non-zero status is received.
-f noglob: Do not expand file names. This globally turns off the special
meaning of characters `*' and `?'.
-h trackall: Automatically add all commands to the shell's hash table.
-k keyword: Recognize variable assignments anywhere in a command.
-m monitor: Enable job control. See the Lexicon article on ksh for details
on job control and how to use it.
-n noexec: Compile an input command, but do not execute it.
-o option
Set option. set recognizes the following options:
allexport
Same as -a option, above.
emacs Turn on MicroEMACS-style editing of command lines.
errexit
Same as -e option, above.
ignoreeof
Tell the shell not to exit when reading EOF: must use exit
command to exit from the shell.
keyword
Same as -k option, above.
monitor
Same as -m option, above.
noexec Same as -n option, above.
noglob Same as -f option, above.
trackall
Same as -h option, above.
nounset
Same as -u option, below.
verbose
Same as -v option, below.
xtrace Same as -x option, below.
-u nounset: Treat dollar-sign expansion of an unset variable as an error.
-v verbose: When compiling a command, echo its compiled (i.e., expanded)
version on the standard output before executing it.
-x xtrace: Echo simple commands while executing.
The shells execute set directly.
See Also
commands,
ksh,
sh,
unset