sh-posix.1 (2010 09)
s
sh-posix(1) sh-posix(1)
% set [{-+}
abCefhkmnopstuvx][{
-+}o option ]... [{-+}A name][arg]...
Set (
-) or clear (
+) execution options or perform array assignments (-A, +A). All options except -A
and +A can be supplied in a shell invocation (see the SYNOPSIS section and the Shell Invocation
subsection).
Using
+ instead of - before an option causes the option to be turned off. These options can also be
used when invoking the shell. The current list of set single-letter options is contained in the shell
variable -. It can be examined with the command
echo $-.
The
- and + options can be intermixed in the same command, except that there can be only one
-A
or +A option.
Unless
-A or +A is specified, the remaining arg arguments are assigned consecutively to the posi-
tional parameters
1, 2, ....
The
set command with neither arguments nor options displays the names and values of all shell
parameters on standard output. See also env (1).
The options are defined as follows.
-A Array assignment. Unset the variable name and assign values sequentially from the list arg.
With
+A, do not unset the variable name first.
-a Automatically export subsequently defined parameters.
-b Cause the shell to notify the user asynchronously of background jobs as they are completed.
When the shell notifies the user that a job has been completed, it can remove the job’s process
ID from the list of those known in the current shell execution environment.
-C Prevent redirection > from truncating existing regular files. Requires
>| to truncate a file
when turned on.
-e Execute the ERR trap, if set, and exit if a command has a nonzero exit status, and is not part
of the compound list following a if, until,orwhile keyword, and is not part of an AND or
OR list, and is not a pipeline preceded by the ! reserved word. This mode is disabled while
reading profiles.
-f Disable file name generation.
-h Specify that each command whose name is an identifier becomes a tracked alias when first
encountered.
-k Place all parameter assignment arguments (not just those that precede the command name)
into the environment for a command.
-m Run background jobs in a separate process group and print a line upon completion. The exit
status of background jobs is reported in a completion message. This option is turned on
automatically for interactive shells.
-n Read commands and check them for syntax errors, but do not execute them. The
-n option is
ignored for interactive shells.
-o Set an option argument from the following list. Repeat the -o option to specify additional
option arguments.
allexport Same as -a.
bgnice Run all background jobs at a lower priority.
emacs Use a emacs-style inline editor for command entry.
errexit Same as -e.
gmacs Use a gmacs-style inline editor for command entry.
ignoreeof Do not exit from the shell on end-of-file (eof , as defined by stty; default is
^D). The exit special command must be used.
keyword Same as -k.
markdirs Append a trailing / to all directory names resulting from file name generation.
monitor Same as -m.
noclobber Same as -C.
noexec Same as -n.
noglob Same as -f.
nolog Do not save function definitions in history file.
notify Same as -b.
8 Hewlett-Packard Company − 8 − HP-UX 11i Version 3: September 2010