Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S

sh-posix(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

sh-posix: sh, rsh — standard and restricted POSIX.2-conformant command shells

SYNOPSIS

shaefhikmnprstuvx] [±o option]... [-c string] [arg]...

rshaefhikmnprstuvx] [±o option]... [-c string] [arg]...

Remarks

This shell is intended to conform to the shell specification of the POSIX.2 Shell and Utility standards. Check any standards conformance documents shipped with your system for information on the conformance of this shell to any other standards.

List of Subheadings in DESCRIPTION

Shell InvocationTilde SubstitutionEnvironment
OptionsCommand SubstitutionFunctions
rsh RestrictionsParameter SubstitutionJobs
DefinitionsBlank InterpretationSignals
CommandsFile Name GenerationExecution
Simple CommandsQuotingCommand Reentry
Compound CommandsArithmetic EvaluationCommand Line Editing
Special CommandsPromptingemacs/gmacs Editing Mode
CommentsConditional Expressionsvi Editing Mode
AliasingInput/Output 

DESCRIPTION

sh is a command programming language that executes commands read from a terminal or a file.

rsh is a restricted version of sh. See the rsh Restrictions subsection below.

Shell Invocation

If the shell is invoked by an exec*() system call and the first character of argument zero (shell parameter 0) is dash (-), the shell is assumed to be a login shell and commands are read first from /etc/profile, then from either .profile in the current directory or $HOME/.profile if either file exists, and finally from the file named by performing parameter substitution on the value of the environment parameter ENV, if the file exists. If the -s option is not present and an arg is, a path search is performed on the first arg to determine the name of the script to execute. When running sh with arg, the script arg must have read permission and any setuid and setgid settings will be ignored. Commands are read as described below.

Shell output, except for the output of some of the commands listed in the Special Commands subsection, is written to standard error (file descriptor 2).

Options

The following options are interpreted by the shell when it is invoked.

-c string

Read commands from string.

-i

If -i is present or if the shell input and output are attached to a terminal (as reported by tty()), the shell is interactive. In this case SIGTERM is ignored and SIGINT is caught and ignored (so that wait is interruptible). In all cases, SIGQUIT is ignored by the shell. See signal(5).

-r

The shell is a restricted shell.

-s

If -s is present or if no arguments remain, commands are read from the standard input.

The remaining options and operands are described under the set command in the Special Commands subsection.

rsh Restrictions

rsh is used to set up login names and execution environments where capabilities are more controlled than those of the standard shell. The actions of rsh are identical to those of sh, except that the following are forbidden:

  • Changing directory (see the cd special command and cd(1))

  • Setting the value of SHELL, ENV, or PATH

  • Specifying path or command names containing /

  • Redirecting output (>, >|, <>, and >>)

The restrictions above are enforced after the .profile and ENV files are interpreted.

When a command to be executed is found to be a shell procedure, rsh invokes sh to execute it. Thus, the end-user is provided with shell procedures accessible to the full power of the standard shell, while being restricted to a limited menu of commands. This scheme assumes that the end-user does not have write and execute permissions in the same directory.

These rules effectively give the writer of the .profile file complete control over user actions, by performing guaranteed set-up actions and leaving the user in an appropriate directory (probably not the login directory).

The system administrator often sets up a directory of commands (usually /usr/rbin) that can be safely invoked by rsh. HP-UX systems provide a restricted editor red (see ed(1)), suitable for restricted users.

Definitions

metacharacter

One of the following characters:

; & ( ) | < > newline space tab

blank

A tab or a space.

identifier

A sequence of letters, digits, or underscores starting with a letter or underscore. Identifiers are used as names for functions and named parameters.

word

A sequence of characters separated by one or more nonquoted metacharacters.

command

A sequence of characters in the syntax of the shell language. The shell reads each command and carries out the desired action, either directly or by invoking separate utilities.

special command

A command that is carried out by the shell without creating a separate process. Except for documented side effects, most special commands can be implemented as separate utilities.

#

Comment delimiter. A word beginning with # and all following characters up to a newline are ignored.

parameter

An identifier, a decimal number, or one of the characters !, #, $, *, -, ?, @, and _. See the Parameter Substitution subsection.

named parameter

A parameter that can be assigned a value. See the Parameter Substitution subsection.

variable

A parameter.

environment variable

A parameter that is known outside the local shell, usually by means of the export special command.

Commands

A command can be a simple command that executes an executable file, a special command that executes within the shell, or a compound command that provides flow of control for groups of simple, special, and compound commands.

Simple Commands

A simple command is a sequence of blank-separated words that may be preceded by a parameter assignment list. (See the Environment subsection). The first word specifies the name of the command to be executed. Except as specified below, the remaining words are passed as arguments to the invoked command. The command name is passed as argument 0 (see exec(2)). The value of a simple command is its exit status if it terminates normally, or 128+errorstatus if it terminates abnormally (see signal(5) for a list of errorstatus values).

A pipeline is a sequence of one or more commands separated by a bar (|) and optionally preceded by an exclamation mark (!). The standard output of each command but the last is connected by a pipe (see pipe(2)) to the standard input of the next command. Each command is run as a separate process; the shell waits for the last command to terminate. If ! does not precede the pipeline, the exit status of the pipeline is the exit status of the last command in the pipeline. Otherwise, the exit status of the pipeline is the logical negation of the exit status of the last command in the pipeline.

A list is a sequence of one or more pipelines separated by ;, &, &&, or ||, and optionally terminated by ;, &, or |&.

;

Causes sequential execution of the preceding pipeline. An arbitrary number of newlines can appear in a list, instead of semicolons, to delimit commands.

&

Causes asynchronous execution of the preceding pipeline (that is, the shell does not wait for that pipeline to finish).

|&

Causes asynchronous execution of the preceding command or pipeline with a two-way pipe established to the parent shell. The standard input and output of the spawned command can be written to and read from by the parent shell using the -p option of the special commands read and print.

&&

Causes the list following it to be executed only if the preceding pipeline returns a zero value.

||

Causes the list following it to be executed only if the preceding pipeline returns a nonzero value.

Of these five symbols, ;, &, and |& have equal precedence, which is lower than that of && and ||. The symbols && and || also have equal precedence.

Compound Commands

Unless otherwise stated, the value returned by a compound command is that of the last simple command executed in the compound command. The ; segment separator can be replaced by one or more newlines.

The following keywords are recognized only as the first word of a command and when not quoted:

! } elif for then [[ case else function time ]] do esac if until { done fi select while

A compound command is one of the following.

case word in [[;] [(] pattern [| pattern]...) list ;;]... ; esac

  • Execute the list associated with the first pattern that matches word. The form of the patterns is identical to that used for file name generation (see the File Name Generation subsection). The ;; case terminator cannot be replaced by newlines.

for identifier [in word ...] ; do list ; done

  • Set identifier to each word in sequence and execute the do list. If in word ... is omitted, set identifier to each set positional parameter instead. See the Parameter Substitution subsection. Execution ends when there are no more positional parameters or words in the list.

function identifier { list ; } identifier () { list ; }

  • Define a function named by identifier. A function is called by executing its identifier as a command. The body of the function is the list of commands between { and }. See the Functions subsection.

if list ; then list ; [elif list ; then list ;]... [else list ;] fi

  • Execute the if list and, if its exit status is zero, execute the first then list. Otherwise, execute the elif list (if any) and, if its exit status is zero, execute the next then list. Failing that, execute the else list (if any). If no else list or then list is executed, if returns a zero exit status.

select identifier [in word ...] ; do list ; done

  • Print the set of words on standard error (file descriptor 2), each preceded by a number. If in word ... is omitted, print the positional parameters instead (see the Parameter Substitution subsection). Print the PS3 prompt and read a line from standard input into the parameter REPLY. If this line consists of the number of one of the listed words, set identifier to the corresponding word, execute list, and repeat the PS3 prompt. If the line is empty, print the selection list again, and repeat the PS3 prompt. Otherwise, set identifier to null, execute list, and repeat the PS3 prompt. The select loop repeats until a break special command or end-of-file is encountered.

time pipeline

  • Execute the pipeline and print the elapsed time, the user time, and the system time on standard error. Note that the time keyword can appear anywhere in the pipeline to time the entire pipeline. To time a particular command in a pipeline, see time(1).

until list ; do list ; done

  • Execute the until list. If the exit status of the last command in the list is nonzero, execute the do list and execute the until list again. When the exit status of the last command in the until list is zero, terminate the loop. If no commands in the do list are executed, until returns a zero exit status.

while list ; do list ; done

  • Execute the while list. If the exit status of the last command in the list is zero, execute the do list and execute the while list again. When the exit status of the last command in the while list is nonzero, terminate the loop. If no commands in the do list are executed, while returns a nonzero exit status.

( list )

  • Execute list in a separate environment. If two adjacent open parentheses are needed for nesting, a space must be inserted between them to avoid arithmetic evaluation.

{ list ; }

  • Execute list, but not in a separate environment. Note that { is a keyword and requires a trailing blank to be recognized.

[[ expression ]]

  • Evaluate expression and return a zero exit status when expression is true. See the Conditional Expressions subsection for a description of expression. Note that [[ and ]] are keywords and require blanks between them and expression.

Special Commands

Special commands are simple commands that are executed in the shell process. They permit input/output redirection. Unless otherwise indicated, file descriptor 1 (standard output) is the default output location and the exit status, when there are no syntax errors, is zero.

Commands that are marked with "%" are treated specially in the following ways:

1.

Variable assignment lists preceding the command remain in effect when the command completes.

2.

I/O redirections are processed after variable assignments.

3.

Certain errors cause a script that contains them to abort.

Words following commands marked with "&" that are in the format of a variable assignment are expanded with the same rules as a variable assignment. This means that tilde substitution is performed after the = sign and word-splitting and file-name generation are not performed.

% : [arg]...

  • (colon) Only expand parameters. A zero exit status is returned.

% . file [arg]...

  • (period) Read and execute commands from file and return. The commands are executed in the current shell environment. The search path specified by PATH is used to find the directory containing file. If any arguments arg are given, they become the positional parameters. Otherwise, the positional parameters are unchanged. The exit status is the exit status of the last command executed.

& alias [-tx] [name[=value]]...

  • With name=value specified, define name as an alias and assign it the value value. A trailing space in value causes the next word to be checked for alias substitution.

  • With name=value omitted, print the list of aliases in the form name=value on standard output.

  • With name specified without =value, print the specified alias.

  • With -t, set tracked aliases. The value of a tracked alias is the full path name corresponding to the given name. The value of a tracked alias becomes undefined when the value of PATH is reset, but the alias remains tracked. With name=value omitted, print the list of tracked aliases in the form name=pathname on standard output.

  • With -x, set exported aliases. An exported alias is defined across subshell environments. With name=value omitted, print the list of exported aliases in the form name=value on standard output.

  • Alias returns true unless a name is given for which no alias has been defined.

  • See also the unalias special command.

bg [job]...

  • Put the specified jobs into the background. The current job is put in the background if job is unspecified. See the Jobs subsection for a description of the format of job. See also the fg special command.

% break [n]

  • Exit from the enclosing for, select, until, or while loop, if any. If n is specified, exit from n levels.

cd [-L|-P] [arg] cd old new

  • In the first form, change the current working directory (PWD) to arg. If arg is -, the directory is changed to the previous directory (OLDPWD). The shell parameter HOME is the default arg. After the cd, the PWD and OLDPWD environment variables are set to the new current directory and the former directory respectively.

  • With -L (default), preserve logical naming when treating symbolic links. cd -L .. moves the current directory one path component closer to the root directory.

  • With -P, preserve the physical path when treating symbolic links. cd -P .. changes the working directory to the actual parent directory of the current directory.

  • The shell parameter CDPATH defines the search path for the directory containing arg. Alternative directory names are separated by a colon (:). If CDPATH is null or undefined, the default value is the current directory. Note that the current directory is specified by a null path name, which can appear immediately after the equal sign or between the colon delimiters anywhere else in the path list. If arg begins with a /, the search path is not used. Otherwise, each directory in the path is searched for arg. See also cd(1).

  • The second form of cd substitutes the string new for the string old in the current directory name, PWD, and tries to change to this new directory.

command [arg]...

  • Treat arg as a command, but disable function lookup on arg. See command(1) for usage and description.

% continue [n]

  • Resume the next iteration of the enclosing for, select, until, or while loop. If n is specified, resume at the nth enclosing loop.

echo [arg]...

  • Print arg on standard output. See echo(1) for usage and description. See also the print special command.

% eval [arg]...

  • Read the arguments as input to the shell and execute the resulting commands. Allows parameter substitution for keywords and characters that would otherwise be unrecognized in the resulting commands.

% exec [arg]...

  • Parameter assignments remain in effect after the command completes. If arg is given, execute the command specified by the arguments in place of this shell without creating a new process. Input/output arguments may appear and affect the current process. If no arguments are given, modify file descriptors as prescribed by the input/output redirection list. In this case, any file descriptor numbers greater than 2 that are opened with this mechanism are closed when another program is invoked.

% exit [n]

  • Exit from the shell with the exit status specified by n. If n is omitted, the exit status is that of the last command executed. An end-of-file also causes the shell to exit, except when a shell has the ignoreeof option set. (See the set special command.)

%& export [name[=value]]... %& export -p

  • Mark the given variable names for automatic export to the environment of subsequently executed commands. Optionally, assign values to the variables.

  • With no arguments, write the names and values of all exported variables to standard output,

  • With -p, write the names and values of all exported variables to standard output, in a format with the proper use of quoting, so that it is suitable for re-input to the shell as commands that achieve the same exporting results.

fc [-r] [-e ename] [first [last]] fc -l [-nr] [first [last]] fc -s [old=new] [first] fc -e - [old=new] [command]

  • List, or edit and reexecute, commands previously entered to an interactive shell. A range of commands from first to last is selected from the last HISTSIZE commands typed at the terminal. The arguments first and last can be specified as a number or string. A given string is used to locate the most recent command. A negative number is used to offset the current command number.

  • With -l, list the commands on standard output. Without -l, invoke the editor program ename on a file containing these keyboard commands. If ename is not supplied, the value of the parameter FCEDIT (default /usr/bin/ed) is used as the editor. Once editing has ended, the commands (if any) are executed. If last is omitted, only the command specified by first is used. If first is not specified, the default is the previous command for editing and -16 for listing.

  • With -r, reverse the order of the commands.

  • With -n, suppress command numbers when listing.

  • With -s, reexecute the command without invoking an editor.

  • The old=new argument replaces the first occurrence of string old in the command to be reexecuted by the string new.

fg [job]...

  • Bring each job into the foreground in the order specified. If no job is specified, bring the current job into the foreground. See the Jobs subsection for a description of the format of job. See also the bg special command.

getopts optstring name [arg]...

  • Parse the argument list, or the positional parameters if no arguments, for valid options. On each execution, return the next option in name. See getopts(1) for usage and description.

  • An option begins with a + or a -. An argument not beginning with + or -, or the argument --, ends the options. optstring contains the letters that getopts recognizes. If a letter is followed by a :, that option is expected to have an argument. The options can be separated from the argument by blanks.

  • For an option specified as -letter, name is set to letter. For an option specified as +letter, name is set to +letter. The index of the next arg is stored in OPTIND. The option argument, if any, is stored in OPTARG. If no option argument is found, or the option found does not take an argument, OPTARG is unset.

  • A leading : in optstring causes getopts to store the letter of an invalid option in OPTARG, and to set name to ? for an unknown option and to : when a required option argument is missing. Otherwise, getopts prints an error message. The exit status is nonzero when there are no more options.

& hash [utility]... & hash -r

  • Affect the way the current shell environment remembers the locations of utilities. With utility, add utility locations to a list of remembered locations. With no arguments, print the contents of the list. With -r, forget all previously remembered utility locations.

jobs [-lnp] [job]...

  • List information about each given job, or all active jobs if job is not specified. With -l, list process IDs in addition to the normal information. With -n, display only jobs that have stopped or exited since last notified. With -p, list only the process group. See the Jobs subsection for a description of the format of job.

kill [-s signal] process ... kill -l kill [-signal] process ...

  • Send either signal 15 (SIGTERM, terminate) or the specified signal to the specified jobs or processes. If the signal being sent is TERM (terminate) or HUP (hangup), the job or process is sent a CONT (continue) signal when stopped. See kill(1) for usage and description.

  • With -l, list the signal names and numbers.

let arg ... (( arg ...))

  • Evaluate each arg as a separate arithmetic expression. See the Arithmetic Evaluation subsection for a description of arithmetic expression evaluation. The exit status is 0 if the value of the last expression is nonzero, and 1 otherwise.

% newgrp [-] [group]

  • Replace the current shell with a new one having group as the user's group. The default group is the user's login group. With -, also execute the user's .profile and $ENV files. See newgrp(1) for usage and description. Equivalent to exec newgrp arg ....

print [-nprRsu[n]] [arg]...

  • The shell output mechanism. With no options or with option - or --, print the arguments on standard output as described in echo(1). See also printf(1).

  • With -n, do not add a newline character to the output.

  • With -p, write the arguments onto the pipe of the process spawned with |& instead of standard output.

  • With -R or -r (raw mode), ignore the escape conventions of echo. With -R, print all subsequent arguments and options other than -n.

  • With -s, write the arguments into the history file instead of to standard output.

  • With -u, specify a one-digit file descriptor unit number n on which the output will be placed. The default is 1 (standard output).

pwd [-L|-P]

  • Print the name of the current working directory (equivalent to print -r - $PWD). With -L (the default), preserve the logical meaning of the current directory. With -P, preserve the physical meaning of the current directory if it is a symbolic link. See also the cd special command, cd(1), ln(1), and pwd(1).

read [-prsu[n]] [name?prompt] [name]...

  • The shell input mechanism. Read one line (by default, from standard input) and break it up into words using the characters in IFS as separators. The first word is assigned to the first name, the second word to the second name, and so on; the remaining words are assigned to the last name. See also read(1). The return code is 0, unless an end-of-file is encountered.

  • With -p, take the input line from the input pipe of a process spawned by the shell using |&. An end-of-file with -p causes cleanup for this process so that another process can be spawned.

  • With -r (raw mode), a \ at the end of a line does not signify line continuation.

  • With -s, save the input as a command in the history file.

  • With -u, specify a one-digit file descriptor unit to read from. The file descriptor can be opened with the exec special command. The default value of n is 0 (standard input). If name is omitted, REPLY is used as the default name.

  • If the first argument contains a ?, the remainder of the argument is used as a prompt when the shell is interactive.

  • If the given file descriptor is open for writing and is a terminal device, the prompt is placed on that unit. Otherwise, the prompt is issued on file descriptor 2 (standard error).

%& readonly [name[=value]]... %& readonly -p

  • Mark the given names read only. These names cannot be changed by subsequent assignment.

  • With -p, write the names and values of all read-only variables to standard output in a format with the proper use of quoting so that it is suitable for re-input to the shell as commands that achieve the same attribute-setting results.

% return [n]

  • Cause a shell function to return to the invoking script with the return status specified by n. If n is omitted, the return status is that of the last command executed. Only the low 8 bits of n (decimal 0 to 255) are passed back to the caller. If return is invoked while not in a function or a . script (see the . special command), it has the same effect as an exit command.

    % 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 positional 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, or while 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.

    nounset

    Same as -u.

    privileged

    Same as -p.

    trackall

    Same as -h.

    verbose

    Same as -v.

    vi

    Use a vi-style inline editor for command entry.

    viraw

    Process each character as it is typed in vi mode (always on).

    xtrace

    Same as -x.

    -p

    Disable processing of the $HOME/.profile file and uses the file /etc/suid_profile instead of the ENV file. This mode is on whenever the effective user ID (group ID) is not equal to the real user ID (group ID). Turning this off causes the effective user ID and group ID to be set to the real user ID and group ID.

    -s

    Sort the positional parameters.

    -t

    Exit after reading and executing one command.

    -u

    Treat unset parameters as an error when substituting.

    -v

    Print shell input lines as they are read.

    -x

    Print commands and their arguments as they are executed.

    -

    Turn off -x and -v options and stop examining arguments for options.

    --

    Do not change any of the options; useful in setting parameter 1 to a value beginning with -. If no arguments follow this option, the positional parameters are unset.

% shift [n]

  • Rename the positional parameters from n+1 ... to 1 .... The default value of n is 1. n can be any arithmetic expression that evaluates to a nonnegative number less than or equal to $#.

test [expr]

  • Evaluate conditional expression expr. See test(1) for usage and description. See also the Conditional Expressions subsection.

  • The arithmetic comparison operators are not restricted to integers. They allow any arithmetic expression. The following additional primitive expressions are allowed:

    -L file

    True if file is a symbolic link.

    -e file

    True if file exists.

    file1 -nt file2

    True if file1 is newer than file2.

    file1 -ot file2

    True if file1 is older than file2.

    file1 -ef file2

    True if file1 has the same device and i-node number as file2.

% times

  • Print the accumulated user and system times for the shell and for processes run from the shell.

% trap [arg] [sig]...

  • Set arg as a command that is read and executed when the shell receives a sig signal. (Note that arg is scanned once when the trap is set and once when the trap is taken.) Each sig can be given as the number or name of a signal. Letter case is ignored. For example, 3, QUIT, quit, and SIGQUIT all specify the same signal. Use kill -l to get a list of signals.

  • Trap commands are executed in signal number order. Any attempt to set a trap on a signal that was ignored upon entering the current shell is ineffective. Traps remain in effect for a given shell until explicitly changed with another trap command; that is, a trap set within a function will remain in effect even after the function returns.

  • If arg is - (or if arg is omitted and the first sig is numeric), reset all traps for each sig to their original values.

  • If arg is the null string ('' or "" ), each sig is ignored by the shell and by the commands it invokes.

  • If sig is DEBUG, then arg is executed after each command. If sig is ERR, arg is executed whenever a command has a nonzero exit code. If sig is 0 or EXIT, the command arg is executed on exit from the shell.

  • With no arguments, print a list of commands associated with each signal name.

    & typeset [{-|+}LRZfilrtux[n]] [name[=value]]... name=value [name=value]...

  • Assign types and a value to a local named parameter name. See also the export special command. Parameter assignments remain in effect after the command completes. When invoked inside a function, create a new instance of the parameter name. The parameter value and type are restored when the function completes.

  • The following list of attributes can be specified. Use + instead of - to turn the options off.

    -L

    Left justify and remove leading blanks from value. If n is nonzero, it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. When name is assigned, the value is filled on the right with blanks or truncated, if necessary, to fit into the field. Leading zeros are removed if the -Z option is also set. The -R option is turned off. Flagged as leftjust n.

    -R

    Right justify and fill with leading blanks. If n is nonzero, it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. The field is left-filled with blanks or truncated from the end if the parameter is reassigned. The -L option is turned off. Flagged as rightjust n.

    -Z

    Right justify and fill with leading zeros if the first nonblank character is a digit and the -L option has not been set. If n is nonzero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. Flagged as zerofill n plus the flag for -L or -R.

    -f

    Cause name to refer to function names rather than parameter names. No assignments can be made to the name declared with the typeset statement. The only other valid options are -t (which turns on execution tracing for this function) and -x (which allows the function to remain in effect across shell procedures executed in the same process environment). Flagged as function.

    -i

    Parameter is an integer. This makes arithmetic faster. If n is nonzero it defines the output arithmetic base; otherwise, the first assignment determines the output base. Flagged as integer [base n].

    -l

    Convert all uppercase characters to lowercase. The uppercase -u option is turned off. Flagged as lowercase.

    -r

    Mark any given name as "read only". The name cannot be changed by subsequent assignment. Flagged as readonly.

    -t

    Tag the named parameters. Tags are user-definable and have no special meaning to the shell. Flagged as tagged.

    -u

    Convert all lowercase characters to uppercase characters. The lowercase -l option is turned off. Flagged as uppercase.

    -x

    Mark any given name for automatic export to the environment of subsequently executed commands. Flagged as export.

  • typeset alone displays a list of parameter names, prefixed by any flags specified above.

  • typeset - displays the parameter names followed by their values. Specify one or more of the option letters to restrict the list. Some options are incompatible with others.

  • typeset + displays the parameter names alone. Specify one or more of the option letters to restrict the list. Some options are incompatible with others.

ulimit [-HSacdfnst] [limit]

  • Set or display a resource limit. The limit for a specified resource is set when limit is specified. The value of limit can be a number in the unit specified with each resource, or the keyword unlimited.

  • The -H and -S flags specify whether the hard limit or the soft limit is set for the given resource. A hard limit cannot be increased once it is set. A soft limit can be increased up to the hard limit. If neither -H nor -S is specified, the limit applies to both. The current resource limit is printed when limit is omitted. In this case, the soft limit is printed unless -H is specified. When more than one resource is specified, the limit name and unit are printed before the value.

  • If no option is given, -f is assumed.

    -a

    List all of the current resource limits.

    -c

    The number of 512-byte blocks in the size of core dumps.

    -d

    The number of kilobytes in the size of the data area.

    -f

    The number of 512-byte blocks in files written by child processes (files of any size can be read).

    -n

    The number of file descriptors.

    -s

    The number of kilobytes in the size of the stack area.

    -t

    The number of seconds to be used by each process.

umask [-S] [mask]

  • Set the user file-creation mask mask. mask can be either an octal number or a symbolic value as described in umask(1). A symbolic value shows permissions that are unmasked. An octal value shows permissions that are masked off.

  • Without mask, print the current value of the mask. With -S, print the value in symbolic format. Without -S, print the value as an octal number. The output from either form can be used as the mask of a subsequent invocation of umask.

unalias name ... unalias -a

  • Remove each name from the alias list. With -a, remove all alias definitions from the current shell execution environment. See also the alias special command.

% unset [-fv] name ...

  • Remove the named shell parameters from the parameter list. Their values and attributes are erased. Read-only variables cannot be unset. With -f, names refer to function names. With -v, names refer to variable names. Unsetting _, ERRNO, LINENO, MAILCHECK, OPTARG, OPTIND, RANDOM, SECONDS, and TMOUT removes their special meaning, even if they are subsequently assigned to.

wait [job]

  • Wait for the specified job to terminate or stop, and report its status. This status becomes the return code for the wait command. Without job, wait for all currently active child processes to terminate and returns with a zero exit status. See the Jobs subsection for a description of the format of job.

whence [-pv] name ...

  • For each name, indicate how it would be interpreted if used as a command name. With -v, produce a more verbose report. With -p do a path search for name, disregarding any use as an alias, a function, or a reserved word.

Comments

A word beginning with # causes that word and all the following characters up to a newline to be ignored.

Aliasing

The first word of each command is replaced by the text of an alias, if an alias for this word has been defined. An alias name consists of any number of characters excluding metacharacters, quoting characters, file expansion characters, parameter and command substitution characters, and =. The replacement string can contain any valid shell script, including the metacharacters listed above. The first word of each command in the replaced text, other than any that are in the process of being replaced, will be tested for additional aliases. If the last character of the alias value is a blank, the word following the alias is also checked for alias substitution. Aliases can be used to redefine special commands, but cannot be used to redefine the keywords listed in the Compound Commands subsection. Aliases can be created, listed, and exported with the alias command and can be removed with the unalias command. Exported aliases remain in effect for subshells but must be reinitialized for separate invocations of the shell (see the Shell Invocation subsection).

Aliasing is performed when scripts are read, not while they are executed. Therefore, for it to take effect, an alias must be executed before the command referring to the alias is read.

Aliases are frequently used as a shorthand for full path names. An option to the aliasing facility allows the value of the alias to be automatically set to the full path name of the corresponding command. These aliases are called tracked aliases. The value of a tracked alias is defined the first time the identifier is read and becomes undefined each time the PATH variable is reset. These aliases remain tracked so that the next reference will redefine the value. Several tracked aliases are compiled into the shell. The -h option of the set command converts each command name that is an identifier into a tracked alias.

The following exported aliases are compiled into the shell but can be unset or redefined:

autoload='typeset -fu' command='command ' functions='typeset -f' history='fc -l' integer='typeset -i' local=typeset nohup='nohup ' r='fc -e -' stop='kill -STOP' suspend='kill -STOP $$' type='whence -v'

Tilde Substitution

After alias substitution is performed, each word is checked to see if it begins with an unquoted tilde (~). If it does, the word up to a / is checked to see if it matches a user name in the /etc/passwd file. If a match is found, the ~ and the matched login name are replaced by the login directory of the matched user. If no match is found, the original text is left unchanged. A ~ alone or before a / is replaced by the value of the HOME parameter. A ~ followed by a + or - is replaced by the value of the parameter PWD and OLDPWD, respectively. In addition, tilde substitution is attempted when the value of a parameter assignment begins with a ~.

Command Substitution

The standard output from a command enclosed in parenthesis preceded by a dollar sign ($(...)) or a pair of grave accents (`...`) can be used as part or all of a word; trailing newlines are removed. In the second (archaic) form, the string between the accents is processed for special quoting characters before the command is executed. See the Quoting subsection. The command substitution $(cat file) can be replaced by the equivalent but faster $(<file). Command substitution of most special commands that do not perform input/output redirection are carried out without creating a separate process.

An arithmetic expression enclosed in double parenthesis preceded by a dollar sign ($((...))) is replaced by the value of the arithmetic expression within the double parenthesis. See the Arithmetic Evaluation subsection for a description of arithmetic expressions.

Parameter Substitution

A parameter is an identifier, one or more decimal digits, or one of the characters !, #, $, *, -, ?, @, and _. A named parameter (a parameter denoted by an identifier) has a value and zero or more attributes. Named parameters can be assigned values and attributes with the typeset special command. Exported parameters pass values and attributes to the environment.

The shell supports a limited one-dimensional array facility. An element of an array parameter is referenced by a subscript. A subscript is denoted by a [, followed by an arithmetic expression, followed by a ]. See the Arithmetic Evaluation subsection. To assign values to an array, use set -A name value .... The value of all subscripts must be in the range of 0 through 1023. Arrays need not be declared. Any reference to a named parameter with a valid subscript is legal and an array is created if necessary. Referencing an array parameter without a subscript is equivalent to referencing the first element.

If the -i integer attribute is set for name, the value is subject to arithmetic evaluation.

Positional parameters, parameters denoted by a number, can be assigned values with the set special command. Parameter 0 is set from argument zero when the shell is invoked.

Use the prefix character $ to specify the value of a parameter for substitution.

$parameter

${parameter}

${parameter[subscript]}

Substitute the value of the parameter, if any. Braces are required when parameter is followed by a letter, digit, or underscore that should not be interpreted as part of its name or when a named parameter is subscripted. If parameter is one or more digits, it is a positional parameter. A positional parameter of more than one digit must be enclosed in braces. The shell reads all the characters from ${ to the matching } as part of the same word, even if it contains braces or metacharacters.

If parameter is * or @, all the positional parameters, starting with 1, are substituted (separated by a field separator character). See the Quoting subsection.

If an array parameter with subscript * or @ is used, the value for each element is substituted (separated by a field separator character).

${#parameter}

If parameter is * or @, the number of positional parameters is substituted. Otherwise, the length of the value of the parameter is substituted.

${#parameter[*]}

Substitute the number of elements in the array.

${parameter:-word}

If parameter is set and is nonnull, substitute its value; otherwise, substitute word.

${parameter:=word}

If parameter is not set or is null, set it to word; then substitute the value of the parameter. Positional parameters may not be assigned in this way.

${parameter:?word}

If parameter is set and is nonnull, substitute its value; otherwise, print word and exit from the shell. If word is omitted, a standard message is printed.

${parameter:+word}

If parameter is set and is nonnull, substitute word; otherwise, substitute nothing.

${parameter#pattern}

${parameter##pattern}

If the shell pattern matches the beginning of the value of parameter, the value of this substitution is the value of the parameter with the matched portion deleted; otherwise, the value of this parameter is substituted. In the former case, the smallest matching pattern is deleted; in the latter case, the largest matching pattern is deleted. These characters, # or %, should be escaped by a backslash (\) or quotes ('').

${parameter%pattern}

${parameter%%pattern}

If the shell pattern matches the end of the value of parameter, the value of parameter with the matched part is deleted; otherwise, substitute the value of parameter. In the former, the smallest matching pattern is deleted; in the latter, the largest matching pattern is deleted. These characters, # or %, should be escaped by a backslash (\) or quotes ('').

In the above, word is not evaluated unless it is used as the substituted string. Thus, in the following example, pwd is executed only if d is not set or is null:

echo ${d:-$(pwd)}

If the colon (:) is omitted from the above expressions, the shell only checks to determine whether or not parameter is set.

• The following parameters are set automatically by the shell:

0

The string used to call the command or script, set from invocation argument zero.

1, 2, ...

The positional parameters.

*, @

All the set positional parameters, separated by a field separator character. See the Quoting subsection.

#

The number of set positional parameters in decimal.

-

Flags supplied to the shell on invocation or by the set command.

?

The decimal exit status returned by the last executed command.

$

The process number of this shell.

_

Initially, the absolute path name of the shell or script being executed, as passed in the environment. Subsequently, it is assigned the last argument of the previous command. This parameter is not set for commands which are asynchronous. This parameter is also used to hold the name of the matching MAIL file when checking for mail.

!

The process number of the last background command invoked.

ERRNO

The value of errno as set by the most recently failed system call. This value is system-dependent and is intended for debugging purposes.

LINENO

The line number of the current line within the script or function being executed.

OLDPWD

The previous working directory set by the cd command.

OPTARG

The value of the last option argument processed by the getopts special command.

OPTERR

If set to 0, OPTERR will suppress error messages from the getopts special command. OPTERR is initially set to 1.

OPTIND

The index of the last option argument processed by the getopts special command.

PPID

The process number of the parent of the shell.

PWD

The present working directory set by the cd command.

RANDOM

Each time this parameter is evaluated, a random integer, uniformly distributed between 0 and 32767, is generated. The sequence of random numbers can be initialized by assigning a numeric value to RANDOM.

REPLY

Set by the select compound command, and by the read special command when no name is supplied.

SECONDS

Each time this parameter is referenced, the number of seconds since shell invocation is returned. If this parameter is assigned a value, the value returned upon reference is the value that was assigned plus the number of seconds since the assignment.

• The following parameters are used by the shell:

CDPATH

The search path for the cd command, a list of directories separated by colons.

COLUMNS

If this variable is set, its value is used to define the width of the edit window for the shell edit modes and for printing select lists.

EDITOR

If the value of this variable ends in emacs, gmacs, or vi and the VISUAL variable is not set, the corresponding option is turned on (see the set special command.

ENV

If this parameter is set, parameter substitution is performed on the value to generate the path name of the script to be executed when the shell is invoked (see the Invocation subsection). This file is typically used for alias and function definitions.

By default, ENV script is executed for interactive shells only. Under the UNIX95 environment (see standards(5)), this file is executed for both interactive and non-interactive shells.

FCEDIT

The default editor name for the fc command.

FPATH

The search path for function definitions, a list of directories separated by colons. This path is searched when a function with the -u attribute is referenced and when a command is not found. If an executable file is found, then it is read and executed in the current environment.

HISTFILE

If this parameter is set when the shell is invoked, its value is the path name of the file that is used to store the command history. The default value is $HOME/.sh_history. If the user is a superuser and no HISTFILE is given, then no history file is used. See the Command Reentry subsection and the WARNINGS section.

HISTSIZE

If this parameter is set when the shell is invoked, the number of previously entered commands accessible to this shell will be greater than or equal to this number. The default is 128.

HOME

The default argument (home directory) for the cd command.

IFS

Internal field separators, normally space, tab, and newline, that are used to separate command words resulting from command or parameter substitution and for separating words with the special command read. The first character of the IFS parameter is used to separate arguments for the $* substitution (see the Quoting subsection). If the value of IFS is space, tab, and newline, or if IFS is unset and it is being used to separate the results of command or parameter substitution, any sequence of IFS characters serves to delimit words; otherwise, each occurrence of a character in IFS serves to delimit a word. If the value of IFS is null, no word splitting is done.

LANG

The locale of your system, which is made up of three parts: language, territory, and code set. The default is the C locale. See environ(5).

LC_ALL

The overriding value for LANG and the LC_* variables. See environ(5).

LC_COLLATE

The collating sequence to use when sorting names and when character ranges occur in patterns. See environ(5).

LC_CTYPE

The character classification information to use. Changing the value of LC_CTYPE after the shell has started does not affect the lexical processing of shell commands in the current shell execution environment or its subshells. See environ(5).

The shell uses LC_CTYPE to detect nonprintable characters in the input and tries to handle them when the emacs, gmacs, or vi editing mode is selected. Not starting a new shell session after setting LC_CTYPE may affect the display of nonprintable input characters in the emacs, gmacs, or vi editing mode.

LC_MESSAGES

The language in which system messages appear, and the language that the system expects for user input of yes and no strings. See environ(5).

LC_MONETARY

The currency symbol and monetary value format. See environ(5).

LC_NUMERIC

The numeric format. See environ(5).

LC_TIME

The date and time format. See environ(5).

LINES

If this variable is set, the value is used to determine the column length for printing select lists. select lists print vertically until about two-thirds of LINES lines are filled.

MAIL

If this parameter is set to the name of a mail file and the MAILPATH parameter is not set, the shell informs the user of arrival of mail in the specified file.

MAILCHECK

How often (in seconds) the shell checks for changes in the modification time of any of the files specified by the MAILPATH or MAIL parameters. The default value is 600 seconds. When the time has elapsed, the shell checks before issuing the next prompt.

MAILPATH

A list of file names separated by colons. If this parameter is set, the shell informs the user of any modifications to the specified files that have occurred within the last MAILCHECK seconds. Each file name can be followed by a ? and a message to be printed, in which case the message will undergo parameter and command substitution with the parameter $_ defined as the name of the changed file. The default message is you have mail in $_.

NLSPATH

The search path for message catalogs, a list of directories separated by colons.

PATH

The search path for commands, a list of directories separated by colons. See the Execution subsection.

PS1

The value of this parameter is expanded for parameter substitution, to define the primary prompt string. The default value is "$ ". The character ! in the primary prompt string is replaced by the command number. See the Command Reentry subsection.

PS2

Secondary prompt string for command completion. The default value is "> ".

PS3

Selection prompt string used within a select loop. If unset, it defaults to "#? ".

PS4

Execution trace string that precedes each line of an execution trace. See the set -x special command. If unset, it defaults to "+ ".

SHELL

The path name of the shell is kept in the environment. When invoked, the shell is restricted if the value of this variable contains an r in the base name.

TMOUT

If set to a value greater than zero, the shell will terminate if a command is not entered within the prescribed number of seconds after issuing the PS1 prompt. (Note that the shell can be compiled with a maximum bound for this value which cannot be exceeded.)

VISUAL

Invokes the corresponding option when the value of this variable ends in emacs, gmacs, or vi. See the set -o special command.

The shell gives default values to IFS, MAILCHECK, PATH, PS1, PS2, and TMOUT. On the other hand, MAIL, ENV, HOME, and SHELL are never set automatically by the shell (although HOME, MAIL, and SHELL are set by login; see login(1)).

Blank Interpretation

After parameter and command substitution, the results of substitution are scanned for field separator characters (defined in IFS), and split into distinct arguments when such characters are found. sh retains explicit null arguments ("" or '') but removes implicit null arguments (those resulting from parameters that have null values).

File Name Generation

Following substitution, each command word is processed as a pattern for file name expansion unless expansion has been disabled with the set -f special command. The form of the patterns is the Pattern Matching Notation defined in regexp(5). The word is replaced with sorted file names matching the pattern. If no file name is found that matches the pattern, the word is left unchanged.

In addition to the notation described in regexp(5), sh recognizes composite patterns made up of one or more patterns separated from each other with a |. Composite patterns can be formed with one or more of the following:

?(pattern-list)

Matches any one of the given patterns.

*(pattern-list)

Matches zero or more occurrences of the given patterns.

+(pattern-list)

Matches one or more occurrences of the given patterns.

@(pattern-list)

Matches exactly one of the given patterns.

!(pattern-list)

Matches anything, except one of the given patterns.

Quoting

Each of the metacharacters (see the Definitions subsection) has a special meaning to the shell and terminates a word unless quoted. A character may be quoted (that is, made to stand for itself) by preceding it with a backslash (\). The pair \newline is ignored; the current and following lines are concatenated.

All characters enclosed between a pair of apostrophes ('...') are quoted. An apostrophe cannot appear within apostrophes.

Parameter and command substitution occurs inside quotation marks (" ..." ). \ quotes the characters \, `, " , and $.

Inside grave accent marks (`...`), \ quotes the characters \, `, and $. If the grave accents occur within quotation marks, \ also quotes the character " .

The meanings of $* and $@ are identical when not quoted or when used as a parameter assignment value or as a file name. However, when used as a command argument, " $* " is equivalent to " $1d$2d..." , whereas " $@ " is equivalent to " $1 " d " $2 " d... (where d is the first character of IFS),

The special meaning of keywords or aliases can be removed by quoting any character of the name. The recognition of function names or special command names cannot be altered by quoting them.

Arithmetic Evaluation

Integer arithmetic is provided with the special command let. Evaluations are performed using long integer arithmetic. Constants take the form base#n or n, where base is a decimal number between two and thirty-six representing the arithmetic base and n is a number in that base. If base# is omitted, base 10 is used.

An arithmetic expression uses the same syntax, precedence, and associativity of expression as the C language. All the integral operators, other than ++, --, ?:, and , are supported. Variables can be referenced by name within an arithmetic expression without using the parameter substitution syntax. When a variable is referenced, its value is evaluated as an arithmetic expression.

A variable can be typed as an integer with the -i option of the typeset special command, as in typeset -i[base] name. Arithmetic evaluation is performed on the value of each assignment to a variable with the -i attribute. If you do not specify an arithmetic base, the first assignment to the variable determines the arithmetic base. This base is used when parameter substitution occurs.

Since many of the arithmetic operators require quoting, an alternative form of the let command is provided. For any command beginning with ((, all characters until the matching )) are treated as a quoted expression. More precisely, ((...)) is equivalent to let " ..." .

Arithmetic expressions given with let command, ((...)), and $((...)) will be processed according to ISOC standard with the exception of ++, --, ?:, and , operators.

Prompting

When used interactively, the shell prompts with the value of PS1 before reading a command. Whenever a newline is received and further input is needed to complete a command, the secondary prompt (the value of PS2) is issued.

Conditional Expressions

A conditional expression is used with the [[ compound command to test attributes of files and to compare strings. Word splitting and file name generation are not performed on the words between [[ and ]]. (See also the test special command.) Each expression can be constructed from one or more of the following unary or binary expressions:

-a file

True, if file exists.

-b file

True, if file exists and is a block special file.

-c file

True, if file exists and is a character special file.

-d file

True, if file exists and is a directory.

-e file

True, if file exists.

-f file

True, if file exists and is an ordinary file.

-g file

True, if file exists and has its setgid bit set.

-h file

True, if file exists and is a symbolic link.

-k file

True, if file exists and has its sticky bit set.

-n string

True, if length of string is nonzero.

-o option

True, if the set option named option is on.

-p file

True, if file exists and is a fifo special file or a pipe.

-r file

True, if file exists and is readable by current process.

-s file

True, if file exists and has a size greater than zero.

-t fildes

True, if file descriptor number fildes is open and is associated with a terminal device.

-u file

True, if file exists and has its setuid bit set.

-w file

True, if file exists and is writable by the current process.

-x file

True, if file exists and is executable by the current process. If file exists and is a directory, then the current process has permission to search in the directory.

-z string

True, if length of string is zero.

-L file

True, if file exists and is a symbolic link.

-O file

True, if file exists and is owned by the effective user ID of this process.

-G file

True, if file exists and its group matches the effective group ID of this process.

-S file

True, if file exists and is a socket.

file1 -nt file2

True, if file1 exists and is newer than file2.

file1 -ot file2

True, if file1 exists and is older than file2.

file1 -ef file2

True, if file1 and file2 exist and refer to the same file.

string = pattern

True, if string matches pattern.

string != pattern

True, if string does not match pattern.

string < string2

True, if string1 comes before string2 based on the ASCII value of their characters.

string > string2

True, if string1 comes after string2 based on the ASCII value of their characters.

exp1 -eq exp2

True, if exp1 is equal to exp2.

exp1 -ne exp2

True, if exp1 is not equal to exp2.

exp1 -lt exp2

True, if exp1 is less than exp2.

exp1 -gt exp2

True, if exp1 is greater than exp2.

exp1 -le exp2

True, if exp1 is less than or equal to exp2.

exp1 -ge exp2

True, if exp1 is greater than or equal to exp2.

A compound expression can be constructed from these primitives by using any of the following, listed in decreasing order of precedence.

(exp)

True, if exp is true. Used to group expressions.

!exp

True, if exp is false.

exp1 && exp2

True, if exp1 and exp2 are both true.

exp1 || exp2

True, if either exp1 or exp2 is true.

Input/Output

Before a command is executed, its input and output can be redirected using a special notation interpreted by the shell. The following can appear anywhere in a simple-command or may precede or follow a command and are not passed on to the invoked command. Command and parameter substitution occurs before word or digit is used, except as noted below. File name generation occurs only if the pattern matches a single file and blank interpretation is not performed.

<word

Use file word as standard input (file descriptor 0).

>word

Use file word as standard output (file descriptor 1). If the file does not exist, it is created. If the file exists, and the noclobber option is on, an error occurs; otherwise, the file is truncated to zero length. Note that the noclobber test is only applied to regular files, not to named pipes or other file types.

>|word

Same as >, except that it overrides the noclobber option.

>>word

Use file word as standard output. If the file exists, output is appended to it (by first searching for the end-of-file); otherwise, the file is created.

<>word

Open file word for reading and writing as standard input.

<<[-]word

The shell input is read up to a line that matches word, or to an end-of-file. No parameter substitution, command substitution or file name generation is performed on word. The resulting document, called a here-document, becomes the standard input. See also the WARNINGS section.

If any character of word is quoted, no interpretation is placed upon the characters of the document. Otherwise, parameter and command substitution occurs, \newline is ignored, and \ must be used to quote the characters \, $, `, and the first character of word.

If - is appended to <<, all leading tabs are stripped from word and from the document.

<&digit

The standard input is duplicated from file descriptor digit (see dup(2)).

>&digit

The standard output is duplicated to file descriptor digit (see dup(2)).

<&-

The standard input is closed.

>&-

The standard output is closed.

<&p

The input from the coprocess is moved to standard input.

>&p

The output to the coprocess is moved to standard output.

If any of the above redirections is preceded by a digit (0 to 9), the file descriptor used is the one specified by the digit, instead of the default 0 (standard input) or 1 (standard output). For example:

2>&1

means open file descriptor 2 for writing as a duplicate of file descriptor 1. Output directed to file descriptor 2 is written in the same location as output to file descriptor 1.

Order is significant in redirection. The shell evaluates each redirection in terms of the (file descriptor, file) assignment at the time of evaluation. For example:

1>fname 2>&1

first assigns file descriptor 1 to file fname. It then assigns file descriptor 2 to the file assigned to file descriptor 1 (that is, fname).

If the order of redirection is reversed, as in

2>&1 1>fname

file descriptor 2 is assigned to the file assigned to file descriptor 1 (probably the terminal) and then file descriptor 1 is assigned to file fname.

By using the redirection operators above, the input and output of a coprocess may be moved to a numbered file descriptor, allowing other commands to write to them and read from them. If the input of the current coprocess is moved to a numbered file descriptor, another coprocess may be started.

If a command is followed by & and job control is inactive, the default standard input for the command is the empty file /dev/null. Otherwise, the environment for the execution of a command contains the file descriptors of the invoking shell as modified by input/output specifications.

Environment

The environment (see environ(5)) is a list of name-value pairs passed to an executed program much like a normal argument list. The names must be identifiers and the values are character strings. The shell interacts with the environment in several ways. When invoked, the shell scans the environment and creates a parameter for each name found, gives it the corresponding value and marks it export. Executed commands inherit the environment. If the user modifies the values of these parameters or creates new ones by using the export or typeset -x special commands, the values become part of the environment. The environment seen by any executed command is thus composed of any name-value pairs originally inherited by the shell, whose values may be modified by the current shell, plus any additions which must be noted in export or typeset -x commands.

The environment for any simple command or function can be augmented by prefixing it with one or more parameter assignments. A parameter assignment argument takes the form identifier=value. For example, both the following

TERM=450 cmd args (export TERM; TERM=450; cmd args)

are equivalent (as far as the execution of cmd is concerned, except for the special commands that are preceded by a percent sign (%).

If the -k option is set, all parameter assignment arguments are placed in the environment, even if they occur after the command name. The following echo statement prints a=b c. After the -k option is set, the second echo statement prints only c:

echo a=b ca=b c set -k echo a=b cc

This feature is intended for use with scripts written for early versions of the shell and its use in new scripts is strongly discouraged. It is likely to disappear someday.

Functions

The function command (described in the Compound Commands subsection) defines shell functions. Shell functions are read and stored internally. Alias names are resolved when the function is read. Functions are executed like commands, with the arguments passed as positional parameters. (See the Execution subsection.)

Functions execute in the same process as the caller and share all files and current working directory with the caller. Traps defined by the caller remain in effect within the function until another trap command is executed. Traps set within a function remain in effect after the function returns. Ordinarily, variables are shared between the calling program and the function. However, the typeset special command can be used within a function to define local variables whose scope includes the current function and all functions it calls.

The return special command is used to return from function calls. Errors within functions return control to the caller.

Function identifiers can be listed with the +f option of the typeset special command. Function identifiers and the associated text of the functions can be listed with the -f option. Functions can be undefined with the -f option of the unset special command.

Ordinarily, functions are unset when the shell executes a shell script. The -xf option of the typeset command allows a function to be exported to scripts that are executed without reinvoking the shell. Functions that must be defined across separate invocations of the shell should be placed in the ENV file.

Jobs

If the monitor option of the set command is turned on, an interactive shell associates a job with each pipeline. It keeps a table of current jobs, printed by the jobs command, and assigns them small integer numbers. When a job is started asynchronously with &, the shell prints a line that looks like:

[1] 1234

indicating that job number 1 was started asynchronously and had one (top-level) process whose process ID was 1234.

If you are running a job and wish to do something else, you can type the suspend character (the susp character defined with stty; see stty(1)) to send a SIGSTOP signal to the current job. The shell then indicates that the job has been Stopped, and prints another prompt. Then you can manipulate the state of this job by putting it in the background with the bg command, running other commands, and eventually returning the job to the foreground with the fg command. A suspend takes effect immediately and resembles an interrupt, since pending output and unread input are discarded when the suspend is entered.

A job running in the background stops if it tries to read from the terminal. Background jobs normally are allowed to produce output, but can be disabled with the stty tostop command. If the user sets this terminal option, background jobs stop when trying to produce output.

There are several ways to refer to jobs in the shell. A job can be referred to by the process ID of any process in the job or by one of the following:

%number

The job with the given number.

%string

Any job whose command line begins with string.

%?string

Any job whose command line contains string.

%%

Current job.

%+

Equivalent to %%.

%-

Previous job.

The shell learns immediately when a process changes state. It informs the user when a job is blocked and prevented from further progress, but only just before it prints a prompt.

When the monitor mode is on, each background job that completes triggers any trap set for SIGCHLD.

If you try to exit from shell while jobs are stopped, you are warned with the message You have stopped jobs. You can use the jobs command to identify them. If you immediately try to exit again, the shell will not warn you a second time, and the stopped jobs will be terminated.

If you try to leave the shell while jobs are running, you are not warned. The shell exits silently and sets the parent of the running jobs to the init process (number 1).

Signals

The SIGINT and SIGQUIT signals for an invoked command are ignored if the command is followed by & and the monitor option is off. Otherwise, signals have the values inherited by the shell from its parent, with the exception of signal SIGSEGV (but see also the trap special command).

Execution

Substitutions are made each time a command is executed. sh checks the command name to determine whether it matches a special command. If it does, it is executed within the current shell process.

Next, sh checks the command name to determine whether it matches one of the user-defined functions. If it does, sh saves the positional parameters, then sets them to the arguments of the function call. The positional parameter 0 is unchanged. When the function completes or issues a return, sh restores the positional parameter list. The value of a function is the value of the last command executed. A function is executed in the current shell process.

If a command name is not a user-defined function or a special command, sh creates a process and attempts to execute the command using an exec*() system call (see exec(2)).

The shell parameter PATH defines the search path for the directory containing the command. Alternative directory names are separated by a colon (:). The default path is /usr/bin: (specifying /usr/bin, and the current directory, in that order). Note that the current directory is specified by a null path name, which can appear immediately after the equal sign, between colon delimiters, or at the end of the path list. The search path is not used if the command name contains a /. Otherwise, each directory in the path is searched for an executable file. If the file has execute permissions but is not a directory or an executable object code file, it is assumed to be a script file, which is a file of data for an interpreter. If the first two characters of the script file are #!, exec*() expects an interpreter path name to follow. exec*() then attempts to execute the specified interpreter as a separate process to read the entire script file. If a call to exec*() fails, sh is spawned to interpret the script file. All nonexported aliases, functions, and named parameters are removed in this case. If the shell command file does not have read permission, or if the setuid and/or setgid bits are set on the file, the shell executes an agent to set up the permissions and execute the shell with the shell command file passed down as an open file. A parenthesized command is also executed in a subshell without removing nonexported quantities.

Command Reentry

The text of the last HISTSIZE (default 128) commands entered from a terminal device is saved in a history file. The file $HOME/.sh_history is used if the HISTFILE variable is not set or writable. A shell can access the commands of all interactive shells that use the same named HISTFILE. The special command fc is used to list or edit a portion of this file. The portion of the file to be edited or listed can be selected by number or by giving the first character or characters of the command. A single command or range of commands can be specified. If you do not specify an editor program as an argument to fc, the value of the parameter FCEDIT is used. If FCEDIT is not defined, /usr/bin/ed is used. The edited command is printed and reexecuted upon leaving the editor. The editor name - is used to skip the editing phase and to reexecute the command. In this case, a substitution parameter of the form old=new can be used to modify the command before execution. For example, if r is aliased to fc -e -, typing r bad=good c reexecutes the most recent command that starts with the letter c and replaces the first occurrence of the string bad with the string good.

The history file will be trimmed when all of the following conditions occurs:

  • Its size is greater than four kilobytes.

  • The number of commands in it is more than HISTSIZE.

  • The file has not been modified in the last ten minutes.

  • The user has write permission for the directory in which the history file resides.

If any one of the above conditions does not occur, the history file will not be trimmed. When the history file is trimmed, the latest HISTSIZE commands will be available in the history file.

Command Line Editing

Normally, each command line typed at a terminal device is followed by a newline or return. If one of the emacs, gmacs, vi, or viraw, options is set, you can edit the command line. An editing option is automatically selected each time the VISUAL or EDITOR variable is assigned a value ending in one of these option names.

The editing features require that the user's terminal accept return without line feed and that a space (" ") must overwrite the current character on the screen. ADM terminal users should set the "space - advance" switch to "space". Hewlett-Packard terminal users should set the straps to "bcGHxZ etX".

The editing modes enable the user to look through a window at the current line. The default window width is 80, unless the value of COLUMNS is defined. If the line is longer than the window width minus two, a mark displayed at the end of the window notifies the user. The mark is one of:

>

The line extends to the right.

<

The line extends to the left.

*

The line extends to both sides of the window.

As the cursor moves and reaches the window boundaries, the window is centered about the cursor.

The search commands in each edit mode provide access to the history file. Only strings are matched, not patterns, although a leading ^ in the string restricts the match to begin at the first character in the line.

Changing the LC_TYPE environment variable can affect the editors. See the Parameter Substitution subsection.

emacs/gmacs Editing Mode

This mode is invoked by either the emacs or gmacs option. The sole difference is how they handle Control-T.

To edit, the user moves the cursor to the point needing correction and inserts or deletes characters or words. All editing commands are control characters or escape sequences. The notation for control characters is caret (^) followed by a character. For example, ^F is the notation for Control-F. This is entered by holding down the Ctrl (control) key and pressing f. The shift key is not pressed. The notation ^? indicates the delete (DEL) key.

The notation for escape sequences is M- followed by a character. For example, M-f (pronounced meta f) is entered by pressing the escape key (Esc) followed by pressing f. M-F is the notation for escape followed by shift (capital) F.

All edit commands operate from any place on the line (not only at the beginning). Neither the return (^M) nor the newline (^J) key is entered after edit commands, except when noted.

^F

Move cursor forward (right) one character.

M-f

Move cursor forward one word. (The editor's idea of a word is a string of characters consisting of only letters, digits and underscores.)

^B

Move cursor backward (left) one character.

M-b

Move cursor backward one word.

^A

Move cursor to start of line.

^E

Move cursor to end of line.

^]char

Move cursor forward to character char on current line.

M-^]char

Move cursor backward to character char on current line.

^X^X

Interchange the cursor and mark.

erase

Delete previous character. The erase character is user-definable with the stty command; it is usually set to ^H. The system default is #.

^D

Delete current character.

eof

Terminate the shell if the current line is null. The eof character is user-definable with the stty command; it is usually set to ^D. The system default is ^D.

M-d

Delete current word.

M-^H

Delete previous word (meta-backspace).

M-h

Delete previous word.

M-^?

Delete previous word (meta-delete). If your interrupt character is ^? (DEL, the default), this command will not work.

^T

In emacs mode, transpose current character with next character. In gmacs mode, transpose two previous characters.

^C

Capitalize current character.

M-c

Capitalize current word.

M-l

Change the current word to lowercase.

^K

Delete from the cursor to the end of the line. If preceded by a numerical parameter whose value is less that the current cursor position, then delete from the given position up to the cursor. If preceded by a numerical parameter whose value is greater than the current cursor position, then delete from the cursor up to the given position.

^W

Kill from the cursor to the mark.

M-p

Push the region from the cursor to the mark on the stack.

kill

Kill the entire current line. If two kill characters are entered in succession, all subsequent consecutive kill characters cause a line feed (useful when using paper terminals). The kill character is user-definable with the stty command; it is usually set to ^X or ^U. The system default is @.

^Y

Restore last item removed from line (yank item back to the line).

^L

Line feed and print current line.

^@

Set mark (null character).

M-

Set mark (meta-space).

^J

Execute the current line (newline).

^M

Execute the current line (return).

^P

Fetch previous command. Each time ^P is entered, the previous command in the history list is accessed.

^N

Fetch next command. Each time ^N is entered the next command in the history list is accessed.

M-<

Fetch the least recent (oldest) history line.

M->

Fetch the most recent (youngest) history line.

^Rstring

Reverse search history for a previous command line containing string. If a parameter of zero is given, the search is forward. string is terminated by a return or newline. If string is preceded by a ^, the matched line must begin with string. If string is omitted, the next command line containing the most recent string is accessed. In this case, a parameter of zero reverses the direction of the search.

^O

Execute the current line and fetch the next line relative to current line from the history file.

M-digits

Define a numeric parameter. The digits are taken as a parameter to the next command. The commands that accept a parameter are erase, ^B, ^C, ^D, ^F, ^K, ^N, ^P, ^R, ^], M-^H, M-., M-_, M-b, M-c, M-d, M-f, M-h, and M-l.

M-letter

Your alias list is searched for an alias by the name _letter (underscore-letter). If an alias of this name is defined, its value is inserted on the input queue. This letter must not be one of the above metafunctions.

M-.

The last word of the previous command is inserted on the line. If preceded by a numeric parameter, the value of this parameter determines which word to insert rather than the last word.

M-_

Same as M-..

M-*

Attempt file name generation on the current word.

M-^[

File name completion (meta-escape). Replaces the current word with the longest common prefix of all file names matching the current word with an asterisk appended. If the match is unique, a / is appended if the file is a directory and a space is appended if the file is not a directory.

M-=

List files matching current word pattern as if an asterisk were appended.

^U

Multiply parameter of next command by 4.

\

Escape next character. Editing characters and your erase, kill, and interrupt characters may be entered in a command line or in a search string, if preceded by a \. The \ removes the next character's editing features (if any).

^V

Display version of the shell.

M-#

Insert a # at the beginning of the line and execute it. This causes a comment to be inserted in the history file.

vi Editing Mode

The editor starts in insert mode until an escape (ESC) is received. This puts you in control mode in which you can move the cursor and perform editing commands. A return in either mode sends the line.

Most control commands accept an optional repeat count prior to the command.

In vi mode on most systems, canonical processing is initially enabled and the command is echoed again if the speed is 1200 baud or greater and contains any control characters, or if less than one second has elapsed since the prompt was printed. The escape (ESC) character terminates canonical processing for the remainder of the command and you can then modify the command line. This scheme has the advantages of canonical processing with the typeahead echoing of raw mode.

Setting the viraw option always disables canonical processing on the terminal. This mode is implicit for systems that do not support two alternate end-of-line delimiters, and may be helpful for certain terminals.

Insert Edit Commands

By default, the editor is in insert mode.

erase

Delete previous inserted character. The erase character is user-definable with the stty command; it is usually set to ^H. The system default is #.

kill

Delete all current inserted characters. The kill character is user-definable with the stty command; it is usually set to ^X or ^U. The system default is @.

\

Escape the next erase or kill character.

eof

Terminate the shell if the current line is null. The eof character is user-definable with the stty command; it is usually set to ^D. The system default is ^D.

^V

Escape next character. Editing characters and erase or kill characters may be entered in a command line or in a search string if preceded by a ^V, which removes the next character's editing features (if any).

^W

Delete the previous blank-separated word.

Motion Edit Commands

These commands move the cursor. The use of count causes a repetition of the command the cited number of times.

[count]l

Cursor forward (right) one character.

[count]w

Cursor forward one alphanumeric word.

[count]W

Cursor forward to the beginning of the next word that follows a blank.

[count]e

Cursor forward to the end of the word.

[count]E

Cursor forward to end of the current blank-delimited word.

[count]h

Cursor backward (left) one character.

[count]b

Cursor backward one word.

[count]B

Cursor backward to preceding blank-separated word.

[count]|

Cursor to column count. Default is 1.

[count]fc

Find the next character c in the current line.

[count]Fc

Find the previous character c in the current line.

[count]tc

Equivalent to fc followed by h.

[count]Tc

Equivalent to Fc followed by l.

[count];

Repeat the last single-character find command, f, F, t, or T.

[count],

Reverses the last single character find command.

0

Cursor to start of line.

^

Cursor to first nonblank character in line.

$

Cursor to end of line.

History Search Commands

These commands access your command history file.

[count]k

Fetch previous command. Each time k is entered, the next earlier command in the history list is accessed.

[count]-

Equivalent to k.

[count]j

Fetch next command. Each time j is entered, the next later command in the history list is accessed.

[count]+

Equivalent to j.

[count]G

The command number count is fetched. The default is the first command in the history list.

/string

Search backward through history for a previous command containing string. string is terminated by a return or newline. If string is preceded by a ^, the matched line must begin with string. If string is null, the previous string is used.

?string

Same as /, but search in the forward direction.

n

Search for next match of the last pattern to the / or ? commands.

N

Search for next match of the last pattern to / or ?, but in reverse direction.

Text Modification Edit Commands

These commands will modify the line.

a

Enter insert mode after the current character.

A

Append text to the end of the line. Equivalent to $a.

[count]cmotion

c[count]motion

Move cursor forward to the character position specified by motion, deleting all characters between the original cursor position and the new position, and enter insert mode. If motion is c, the entire line is deleted.

C

Delete from the current character through the end of line and enter insert mode. Equivalent to c$.

S

Equivalent to cc.

[count]dmotion

d[count]motion

Move cursor to the character position specified by motion, deleting all characters between the original cursor position and the new position. If motion is d, the entire line will be deleted.

D

Delete from the current character through the end of line. Equivalent to d$.

i

Enter insert mode before the current character.

I

Enter insert mode before the beginning of the line. Equivalent to the two-character sequence 0i.

[count]P

Insert the previous text modification before the cursor.

[count]p

Insert the previous text modification after the cursor.

R

Enter insert mode and replace characters on the screen with characters you type, overlay fashion.

[count]rc

Replace the current character with c.

[count]x

Delete the current character.

[count]X

Delete the preceding character.

[count].

Repeat the previous text modification command.

~

Invert the case of the current character and advance the cursor.

[count]_

Append the count word of the previous command at the current cursor location and enter insert mode at the end of the appended text. The last word is used if count is omitted.

*

Append an * to the current word and attempt file name generation. If no match is found, ring the bell. If a match is found, replace the word with the matching string of file names and enter insert mode.

escape

\

Attempt file name completion on the current word. Replace the current word with the longest common prefix of all file names matching the current word with an asterisk appended. If the match is unique, append a / if the file is a directory or append a space if the file is not a directory.

Other Edit Commands

[count]ymotion

y[count]motion

Yank current character through character that motion would move the cursor to and put them into the delete buffer. The text and cursor are unchanged.

Y

Yank from current position to end of line. Equivalent to y$.

u

Undo the last text-modifying command.

U

Undo all the text-modifying commands performed on the line.

[count]v

Execute the command fc -e ${VISUAL:-${EDITOR:-vi}} count in the input buffer. If count is omitted, the current line is used. This executes an editor with the current line as the input "file". When you exit from the editor, the result is executed.

^L

Line feed and print current line.

^J

Execute the current line, regardless of mode (newline).

^M

Execute the current line, regardless of mode (return).

#

Insert a # at the beginning of the current line and after each embedded newline, and execute the line. Useful for inserting the current command line in the history list without executing it.

=

List the file names that match the current word if an asterisk were appended to it.

@letter

Search your alias list for an alias with the name _letter (underscore letter). If an alias of this name is defined, its value is executed as a command sequence on the current line. This provides a simple macro capability.

EXTERNAL INFLUENCES

For information about the UNIX Standard environment, see standards(5).

Environment Variables

LC_COLLATE determines the collating sequence used in evaluating pattern matching notation for file name generation. If it is not defined or is empty, it defaults to the value of LANG.

LC_CTYPE determines the classification of characters as letters, and the characters matched by character class expressions in pattern matching notation. If it is not defined or is empty, it defaults to the value of LANG.

If LANG is not defined or is empty, it defaults to C (see lang(5)).

If any internationalization variable contains an invalid value, they all default to C (see environ(5)).

International Code Set Support

Single- and multibyte character code sets are supported.

RETURN VALUE

Errors detected by the shell, such as syntax errors, cause the shell to return a nonzero exit status. Otherwise, the shell returns the exit status of the last command executed. See also the exit special command.

If the shell is being used noninteractively, the execution of the shell file is abandoned. Runtime errors detected by the shell are reported by printing the command or function name and the error condition. If the line number on which the error occurred is greater than one, the line number is also printed in brackets ([]) after the command or function name.

WARNINGS

Some file descriptors are used internally by the POSIX shell. For HP-UX releases 10.10 and beyond, file descriptors 24 through 30 are reserved. HP-UX releases 10.00 and 10.01 reserve descriptors 54 through 60. Applications using these and forking a subshell should not depend upon them surviving in the subshell or its descendants.

If a command that is a tracked alias is executed, and a command with the same name is installed in a directory in the search path before the directory where the original command was found, the shell will continue to load and execute the original command. Use the -t option of the alias command to correct this situation.

If you move the current directory or one above it, pwd may not give the correct response. Use the cd command with a full path name to correct this situation.

Some very old shell scripts use a caret (^) as a synonym for the pipe character (|). sh does not recognize the caret as a pipe character.

If a command is piped into a shell command, all variables set in the shell command are lost when the command completes.

Using the fc built-in command within a compound command will cause the entire command to disappear from the history file.

The dot (.) special command, as in . file, reads the entire file before any commands are executed. Therefore, alias and unalias commands in the file will not apply to any functions defined in the file.

Traps are not processed while the shell is waiting for a foreground job. Thus, a trap on SIGCHLD is not executed until the foreground job terminates.

The export special command does not handle arrays properly. Only the first element of an array is exported to the environment.

Background processes started from a noninteractive shell cannot be accessed with job control commands.

The value of the IFS variable in the user's environment affects the behavior of scripts.

Collating Order

In an international environment, character ordering is determined by the value of LC_COLLATE, rather than by the binary ordering of character values in the machine collating sequence. This brings with it certain attendant dangers, particularly when using range expressions in file name generation patterns. For example, the command,

rm [a-z]*

might be expected to match all file names beginning with a lowercase alphabetic character. However, if dictionary ordering is specified by LC_COLLATE, it would also match file names beginning with an uppercase character (as well as those beginning with accented letters). Conversely, it would fail to match letters collated after z in languages such as Danish or Norwegian.

The correct (and safe) way to match specific character classes in an international environment is to use a pattern (see regexp(5)) of the form:

rm [[:lower:]]*

This uses LC_CTYPE to determine character classes and works predictably for all supported languages and codesets. For shell scripts produced on noninternationalized systems (or without consideration for the above dangers), it is recommended that they be executed in a non-NLS environment. This requires that LANG, LC_COLLATE, and so on, be set to C or not set at all.

History File and Locales

The history file does not support mixing of locales in the same file. For users of multiple locales, you can assign a unique history file for each locale by setting HISTFILE as:

HISTFILE=$HOME/.sh_hist_${LANG}

On encountering a history file with invalid characters for the current locale setting, the shell will inform the user about it and continue processing user input. No history features will be available to the user in such a session. Restarting the shell after setting a new history file or after removing the current history file allows the user to access the history features.

Here-Document Temp Files

The contents of here-documents are stored in temporary files named /var/tmp/shpid.number. Usually, these temporary files are removed after they are used. However, due to design limitations, these temporary files may sometimes continue to exist after the shell exits. pid is the process ID of the shell. number is a sequence number for the here-document files.

AUTHOR

sh was developed by AT&T, OSF, and HP.

FILES

$HOME/.profile

Read to set up user's custom environment

/etc/passwd

To find home directories

/etc/profile

Read to set up system environment

/etc/suid_profile

Security profile

/sbin/sh

Archived executable, especially for root access

/tmp/shpid.number

For here-documents if /var/tmp is not accessible

/usr/bin/sh

Standard executable for the POSIX shell

/var/tmp/shpid.number

For here-documents if /var/tmp is accessible

STANDARDS CONFORMANCE

sh: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

.: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

:: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

break: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

case: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

continue: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

eval: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

exec: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

exit: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

export: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

for: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

if: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

read: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

return: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

set: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

shift: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

time: SVID2, SVID3, XPG2, XPG3, XPG4

trap: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

unset: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

until: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

while: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.