Sie sind auf Seite 1von 2

MT XIA INC.

PUBLICATIONS - QUICK REFERENCE


KORN SHELL 93 – SET AND UNSET COMMANDS set [-flags] [-o option] [words] set [-flags] [-o option] [words]
sets flags, options and positional parameters. sets flags, options and positional parameters.
Mt Xia publishes information on a variety of topics such as
Business Continuity, Disaster Recovery, High Availability, set -e ON - same as “set -o errexit” set -o emacs ON
AIX, and Shell Programming. set +e OFF - same as “set +o errexit” causes the shell to recognize emacs style command
any command that exits with a non-zero return code line editing. turning this option on turns off the vi or
causes the ERR trap to be executed, then exit the gmacs option.
Mt Xia Inc. shell.
113 East Rich set -o errexit ON - same as “set -e”
Norman, OK 73069 set -f ON - same as “set -o noglob” set +o errexit OFF - same as “set +e”
set +f OFF - same as “set +o noglob” any command that exits with a non-zero return code
Dana French, President disable korn shell pattern expansions, patterns are causes the ERR trap to be executed, then exit.
dfrench@mtxia.com treated as literal strings.
set -o gmacs ON
615.556.0456 set -h ON - same as “set -o trackall” causes the shell to recognize gmacs style command
set +h OFF - same as “set +o trackall” line editing. turning this option ON turns OFF the vi or
set [-flags] [-o option] [words] automatically make each command a tracked alias. emacs option.
sets flags, options and positional parameters.
set -k ON - same as “set -o keyword” set -o ignoreeof ON
set set +k OFF - same as “set +o keyword” set +o ignoreeof OFF
with no flags, options or words, displays the names automatically export all variable assignments to the causes the current shell to require the use of the exit
and values of all shell and environment variables. environment. command.
set -- set -m ON - same as “set -o monitor” set -o keyword ON - same as “set -k”
signals the end of options and disables further option set +m OFF - same as “set +o monitor” set +o keyword OFF - same as “set +k”
processing. Any arguments after the -- are treated as run background jobs in their own process group, print automatically export all variable assignments to the
file names and arguments. An argument of - is a message when they exit; set automatically for environment.
equivalent to --. interactive shells on job control systems.
set -o markdirs ON
set -a ON - same as “set -o allexport” set -n ON - same as “set -o noexec” set +o markdirs OFF
set +a OFF - same as “set +o allexport” set +n OFF - same as “set +o noexec” appends “/” to expanded directory names.
automatically exports all shell variables when they are read commands but do not execute them. This may
set -o monitor ON - same as “set -m”
assigned values. be used to check a shell script for syntax errors. This
set +o monitor OFF - same as “set +m”
is ignored by interactive shells.
set -A arrayname [word ...] run background jobs in their own process group, print
initializes an index array using arrayname as the set -o a message when they exit; set automatically for
name of the array variable. if one or more words is display the current value of all shell options interactive shells on job control systems.
specified, each word is assigned to the array as an
set +o set -o noclobber ON
array element beginning at index position zero (0),
displays all shell options that are “ON”. set +o noclobber OFF
incrementing the index by one (1) for each word.
STDOUT redirection (>) does not overwrite existing
set -o allexport ON – same as “set -a”
set -b ON - same as “set -o notify” files.
set +o allexport OFF – same as “set +a”
set +b OFF - same as “set +o notify”
automatically exports variables upon assignment. set -o noexec ON - same as “set -n”
report the status of terminated background jobs
set +o noexec OFF - same as “set +n”
immediately, don't wait for next command line prompt. set -o bgnice ON
read commands but do not execute them. This may
set +o bgnice OFF
set -C ON - same as “set -o noclobber” be used to check a shell script for syntax errors. This
causes subsequent background jobs to be run at a
set +C OFF - same as “set +o noclobber” is ignored by interactive shells.
lower priority.
STDOUT redirection (>) does not overwrite existing
files.
Copyright 2006 Mt Xia Inc, All Rights Reserved
MT XIA INC. PUBLICATIONS - QUICK REFERENCE
set [-flags] [-o option] [words] set [-flags] [-o option] [words] set [-flags] [-o option] [words]
sets flags, options and positional parameters. sets flags, options and positional parameters. sets flags, options and positional parameters.
set -o noglob ON – same as “set -f” set -o viraw ON set [--] word ...
set +o noglob OFF – same as “set +f” set +o viraw OFF uses words to create positional parameters in the
disable korn shell pattern expansions, patterns are use with vi on systems without a smart tty line current shell. Each word is assigned as a positional
treated as literal strings. discipline. set this option if your tty drive does not parameter beginning at ${1}. The characters of the
have “crt” features or if you want TAB file name IFS variable are used as word separators. The word
set -o nolog ON
completion. list can be a static list or generated via substitution,
set +o nolog OFF
expansion, or evaluation. The “--” option turns off
don't save functions in history file. set -o xtrace ON – same as “set -x”
option processing so that if any word begins with a “-”,
set +o xtrace OFF – same as “set +x”
set -o notify ON – same as “set -b” it is not treated as an option to “set”.
displays the intermediate step during shell processing
set +o notify OFF – same as “set +b”
of each command as the shell performs substitutions,
print job completion messages immediately, don't wait
expansions, and evaluations. sometimes called debug
for next command line prompt.
mode. set [+flags] [+o option] [words]
set -o nounset ON – same as “set -u” unsets flags and options.
set -p ON - same as “set -o privileged”
set +o nounset OFF – same as “set +u”
set +p OFF - same as “set +o privileged”
generate an error if an attempt is made to substitute
don't read $HOME/.profile, and read /etc/suid_profile
an unset variable.
instead of $ENV file. unset [-fnv] [name ...]
set -o pipefail ON unset functions, name references, and variables.
set -s ON
set +o pipefail OFF
sort the existing positional parameters in ASCII text unset name ...
change pipeline exit status to be that of the last
order. unset variable names from the current shell
command in the pipe to fail, or 0 if all commands in
environment.
pipeline complete successfully. set -t ON
read and execute one command, then exit. unset -f name ...
set -o privileged ON – same as “set -p”
unset function names from the current shell
set +o privileged OFF – same as “set +p” set -u ON - same as “set -o nounset”
environment.
don't read the $HOME/.profile, and read the set +u OFF - same as “set +o nounset”
/etc/suid_profile instead of $ENV file. generate an error if an attempt is made to substitute unset -n name ...
an unset variable. unset nameref variables from the current shell
set -o trackall ON – same as “set -h”
environment.
set +o trackall OFF – same as “set +h” set -v ON - same as “set -o verbose”
automatically make each command a tracked alias. set +v OFF - same as “set -o verbose” unset -v name ...
print each shell command line as it is read. unset variable names from the current shell
set -o verbose ON – same as “set -v”
environment.
set +o verbose OFF – same as “set +v” set -x ON - same as “set -o xtrace”
print each shell command line as it is read. set +x OFF - same as “set +o xtrace”
displays the intermediate step during shell processing
set -o vi ON
of each command as the shell performs substitutions,
causes the shell to recognize vi style command line
expansions, and evaluations. sometimes called debug
editing. turning this option ON turns OFF the emacs
mode.
or gmacs option. Press the ESCAPE key to enter
command mode.

Copyright 2006 Mt Xia Inc, All Rights Reserved