Previous | Table of Contents | Next |
DESCRIPTION
The internal set command is used to control the current shell environment. It can perform three basic functions:
|
---|
C Shell |
The C shell utilizes the set command differently from the Bourne or Korn shells . It assigns a value to a variable and displays the name and value of all variables. |
|
The internal unset command removes variables and functions from the shell environment. It does not set them to NUL (\0) but removes the name from the variable table of the shell. Setting a variable to NUL leaves the variable name in the shell variable table with a value of NUL.
COMMAND FORMAT
Following is the general format of the set command.
set [ -aefhkmnopstuvx ] [ -o opt_arg ] [ -A name ] [ args ] set [ +aefhkmnopstuvx ] [ +o opt_arg ] [ +A name ] [ args ] unset [ variables ] unset [ -f ] [ functions ]
C Shell
set variable set variable=value set variable=variable[index] set variable=(wordlist) set variable=$< unset variable
Options
The following list describes the options and their arguments that may be used with the set command.
-- | If arguments follow, do not interpret as options. Prevents a -opt in $1 from being interpreted as an option. If no arguments follow then unset all positional parameters. | |
-a | Automatically export all variables as they are assigned values. Implies that an export variable is performed after each variable is assigned a value. | |
-e | Exit the shell immediately if running a shell script and an error occurs. | |
-f | Filename generation is disabled. The shell no longer expands wildcard characters . | |
-h | Causes each command that you enter on the command line to become a tracked alias. | |
-k | Place all keyword arguments in the environment for a command. By default, only the keyword arguments preceding the command are exported to the environment. | |
-m | Enable the job monitor. A line will be displayed upon completion of each background job. The exit status of each background job is displayed with the completion message. | |
-n | Read but do not execute commands. Useful to check for syntax errors in shell scripts. | |
-o | optargs Allows you to set other and special options. | |
allexport | Same as -a | |
bgnice | Run all background jobs at a lower priority. | |
emacs | The emacs style in-line editor is used for command reentry. See In-line Command Editing in the ksh command, Module 71. | |
errexit | Same as -e | |
gmacs | The gmacs style in-line editor is used for command reentry. | |
ignoreeof | If the shell is the login shell, it will not exit on end-of-file (Ctrl-D). The exit command must be entered. | |
keyword | Same as -k | |
markdirs | A / is appended to all directory names resulting from pathname expansion. | |
mapesc value | Map the escape character (033) to a new value. | |
noclobber | Redirection will not overwrite an existing file. You must use the > symbol to overwrite an existing file. | |
noexec | Same as -n | |
noglob | Same as -f | |
nolog | Function definitions are not stored in the history file. | |
nounset | Same as -u | |
privileged | Same as -p | |
protected | Same as -p, except PATH is reset. | |
verbose | Same as -v | |
vi | The vi style in-line editor is used for command entry. See In-line Command Editing. | |
viraw | Specifies vi character-by-character input. | |
xtrace | Same as -x | |
-p | Toggles the privileged mode on and off. If on, the effective user and group IDs are set to the real ones. If off, the effective IDs are restored to their values when the shell was initially invoked. Thus privileged is on when the effective ID does not match a real ID. When privileged mode is on, the shell |
Disables processing of the $HOME/.profile file. | ||
Uses the /etc/suid_profile instead of your ENV file. | ||
-s | Sorts the positional parameters. | |
-t | Read and execute one command then exit the shell. | |
-u | Unset variables cause an error when substitution is performed. If a variable has not been assigned a value and it is referenced, then an error will occur. | |
-v | Verbose; echo (display) each shell input line as read. | |
-x | Debug; display command lines as they are executed, each command line is preceded by a +. | |
-A | Assign arguments arg to array name in sequential order beginning with element 0. | |
+opt | If any of the above options are preceded by a + (plus sign) instead of a - (hyphen), the option will be disabled or turned off. | |
If no options or arguments are given, set displays the local environment. |
NOTE:
The set command can be used to change or set options and arguments once a shell has begun execution. Set cannot change or set the -c, -i, -r, and -s options from within the current shell.
The following list describes the options and their arguments that may be used to control how unset functions.
-f | The shell unsets only functions that you list on the command line. Variables are not affected. |
Previous | Table of Contents | Next |