sh(1) CLIX sh(1)
NAME
sh, rsh - Runs a standard/restricted command and programming language
SYNOPSIS
sh [+aefhiknrstuvx] [arg ... ]
rsh [+aefhiknrstuvx] [arg ... ]
DESCRIPTION
The sh is a command and programming language that executes commands read
from a terminal or a file. The rsh is a restricted version of the
standard command interpreter sh; it is used to set up login names and
execution environments whose capabilities are more controlled than those
of the standard shell. See Invocation below for the meaning of arguments
to the shell.
Definitions.
A blank is a tab or a space. An identifier is a sequence of letters,
digits, or underscores starting with a letter or underscore. A parameter
is a name, a digit, or any of the characters #, *, @, ?, -, !.
Commands.
A simple-command is a sequence of nonblank words separated by blanks.
(See Environment below.) 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). The value of a simple-command is its exit status
if it terminates normally, or (octal) 200+status if it terminates
abnormally (see signal for a list of status values).
A pipeline is a sequence of one or more commands separated by |. stdout
of each command but the last is connected by a pipe to stdin of the next
command. Each command is run as a separate process; the shell waits for
the last command to terminate. The exit status of a pipeline is the exit
status of the last command.
A list is a sequence of one or more pipelines separated by ;, &, &&, or
||, and optionally terminated by ; or &. Of these four symbols, ; and &
have equal precedence, which is lower than that of && and ||. The symbols
&& and || also have equal precedence. A semicolon (;) causes sequential
execution of the preceding pipeline; an ampersand (&) causes asynchronous
execution of the preceding pipeline (that is, the shell does not wait for
that pipeline to finish). The symbol && (||) causes the list following it
to be executed only if the preceding pipeline returns a zero (nonzero)
value. An arbitrary number of newlines may appear in a list, instead of
semicolons, to delimit a command.
2/94 - Intergraph Corporation 1
sh(1) CLIX sh(1)
A command is either a simple-command or one of the following. Unless
otherwise stated, the value returned by a command is that of the last
simple-command executed in the command.
for identifier [in word ... ] ; do list ; done
Each time a for command is executed, identifier is set to the next
word taken from the in word list. If in word ... is omitted, then
the for command executes the do list once for each positional
parameter that is set (see Parameter Substitution below).
Execution ends when there are no more words in the list.
case word in [pattern [|pattern] ... ) list ;;] ... esac
A case command executes the list associated with the first pattern
that matches word. The form of the patterns is the same as that
used for filename generation (see Filename Generation below) except
that a slash (/), a leading dot, or a dot immediately following a
slash (/) need not be matched explicitly.
if list ; then list2 [ ; elif list3 ; then list4] ... [ ; else listn] ; fi
The list argument is executed and, if it returns a zero exit
status, list2 is executed. Otherwise, list3 is executed and, if
its value is zero, list4 is executed. Failing that, listn is
executed. If no else listn list4 is executed, then the if command
returns a zero exit status.
while list1 ; do list2 ; done
until list1 ; do list2 ; done
A while command repeatedly executes the while list1 and, if the
exit status of the last command in the list is zero, executes the
do list2; otherwise the loop terminates. If no commands in the do
list2 are executed, then the while command returns a zero exit
status; until may be used in place of while to negate the loop
termination test.
(list) Execute list in a sub-shell.
{ list ; }
The list is executed in the current (parent) shell.
name () { list ; }
Define a function which is referenced by name. The body of the
function is the list of commands between { and }. Execution of
functions is described below (see Execution).
The following reserved words are only recognized as the first word of a
command and when not quoted:
if then else elif fi case esac for while until do done { }
Comments.
2 Intergraph Corporation - 2/94
sh(1) CLIX sh(1)
A word beginning with # causes that word and all the following characters
up to a newline to be ignored.
Command Substitution.
The shell reads commands from the string between two grave accents (``)
and stdout from these commands may be used as all or part of a word.
Trailing newlines from stdout are removed.
No interpretation is done on the string before the string is read, except
to remove backslashes (\) used to escape other characters. Backslashes
may be used to escape a grave accent (`) or another backslash (\) and are
removed before the command string is read. Escaping grave accents allows
nested command substitution. If the command substitution lies within a
pair of double quotes (" ... ` ... ` ... "), a backslash used to escape a
double quote (\") will be removed; otherwise, it will be left intact.
If a backslash is used to escape a newline character (\newline), both the
backslash and the newline are removed (see the later section on Quoting).
In addition, backslashes used to escape dollar signs (\$) are removed.
Since no interpretation is done on the command string before it is read,
inserting a backslash to escape a dollar sign has no effect. Backslashes
that precede characters other than \, `, ", newline, and $ are left intact
when the command string is read.
Parameter Substitution.
The character $ is used to introduce substitutable parameters. There are
two types of parameters, positional and keyword. If parameter is a digit,
it is a positional parameter. Positional parameters may be assigned
values by set. Keyword parameters (also known as variables) may be
assigned values by writing:
name=value [name=value] ...
Pattern-matching is not performed on value. There cannot be a function
and a variable with the same name.
${parameter}
The value, if any, of the parameter is substituted. The braces are
required when parameter is followed by a letter, digit, or
underscore that is not to be interpreted as part of its name or
when a variable is subscripted. If parameter is * or @, then all
the positional parameters, starting with $1, are substituted
(separated by a field separator character). Parameter $0 is set
from argument zero when the shell is invoked.
${parameter:-word}
If parameter is set and is non-null then substitute its value;
otherwise substitute word.
2/94 - Intergraph Corporation 3
sh(1) CLIX sh(1)
${parameter:=word}
If parameter is not set or is null then set it to word; the value
of the parameter is then substituted. Positional parameters may
not be assigned to in this way.
${parameter:?word}
If parameter is set and is non-null then substitute its value;
otherwise, display word and exit from the shell. If word is
omitted then a standard message is displayed.
${parameter:+word}
If parameter is set and is non-null then substitute word; otherwise
substitute nothing.
In the above, word is not evaluated unless it is to be used as the
substituted string, so that, 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, then the shell
only checks whether parameter is set or not.
The following parameters are automatically set by the shell:
# The number of positional parameters in decimal.
- Flags supplied to the shell on invocation or by the set command.
? The decimal value returned by the last executed command.
$ The process number of this shell.
! The process number of the last background command invoked.
The following variables are used by the shell:
CDPATH The search path for the cd command.
IFS Internal field separators, normally space, tab, and newline.
HOME The default argument (home directory) for the cd command.
MAIL If this variable is set to the name of a mail file and the MAILPATH
variable is not set, then the shell informs the user of arrival of
mail in the specified file.
MAILCHECK
This variable specifies how often (in seconds) the shell will check
for the arrival of mail in the files specified by the MAILPATH or
MAIL variables. The default value is 600 seconds. If set to 0,
4 Intergraph Corporation - 2/94
sh(1) CLIX sh(1)
the shell will check before issuing the next prompt.
MAILPATH
A colon (:) separated list of filenames. If this variable is set
then the shell informs the user of the arrival of mail in any of
the specified files. Each filename can be followed by a % and a
message that will be displayed when the modification time changes.
The default message is you have mail.
PATH The search path for commands (see Execution below). The user may
not change PATH if executing under rsh.
PS1 Primary prompt string which by default is ``$ ''.
PS2 Secondary prompt string, by default ``> ''.
SHACCT If this parameter is set to the name of a file writable by the
user, the shell will write an accounting record in the file for
each shell procedure executed.
SHELL When the shell is invoked, it scans the environment (see
Environment below) for this name. If it is found and rsh is the
filename part of it's value, the shell becomes a restricted shell.
The shell gives default values to PATH, PS1, PS2, MAILCHECK, and IFS,
while HOME and MAIL are set by login.
Blank Interpretation.
After parameter and command substitution, the results of substitutions are
scanned for the field separator characters (those found in IFS) and split
into distinct arguments where such characters are found. Explicit null
arguments ("" or '') are retained. Implicit null arguments (those
resulting from parameters that have no values) are removed.
Filename Generation.
Following substitution, each command word is scanned for the characters *,
?, and [. If one of these characters appears then the word is regarded as
a pattern. The word is replaced with lexicographically sorted filenames
that match the pattern. If no filename is found that matches the pattern,
then the word is left unchanged. When a pattern is used for filename
generation, the character . at the start of a filename or immediately
following a /, as well as the character / itself, must be matched
explicitly. In other instances of pattern matching the / and . are not
treated specially.
* Matches any string, including the null string.
? Matches any single character.
2/94 - Intergraph Corporation 5
sh(1) CLIX sh(1)
[ ... ] Matches any one of the enclosed characters. A pair of
characters separated by - matches any character lexically
between the pair, inclusive. If the first character following
the opening ``[ '' is a ``! '' then any character not enclosed
is matched. A - can be included in the character set by putting
it as the first or last character.
A pattern-list is a list of one or more patterns separated from each other
with a |.
Quoting
The following characters have a special meaning to the shell and cause
termination of a word unless quoted:
; & ( ) | ^ < > newline space tab
A character may be quoted (that is, made to stand for itself) by preceding
it with a backslash (\) or inserting it between a pair of quote marks (''
or ""). During processing, the shell may quote certain characters to
prevent them from taking on a special meaning. Backslashes used to quote
a single character are removed from the word before the command is
executed. The pair \newline is removed from a word before command and
parameter substitution.
All characters enclosed between a pair of single quote marks (''), except
a single quote, are quoted by the shell. Backslash has no special meaning
inside a pair of single quotes. A single quote may be quoted inside a
pair of double quote marks (for example, "'").
Inside a pair of double quote marks (""), parameter and command
substitution occurs and the shell quotes the results to avoid blank
interpretation and filename generation. If $* is within a pair of double
quotes, the positional parameters are substituted and quoted, separated by
quoted spaces ("$1 $2 ... "); however, if $@ is within a pair of double
quotes, the positional parameters are substituted and quoted, separated by
unquoted spaces ("$1" "$2" ... ). The backslash (\) quotes the characters
\, ', ", and $. The pair \newline is removed before parameter and command
substitution. If a backslash precedes characters other than \, ', ", $,
and newline, then the backslash itself is quoted by the shell.
Prompting.
When used interactively, the shell prompts with the parameter expanded
value of PS1 before reading a command. If at any time a newline is typed
and further input is needed to complete a command, then the secondary
prompt (that is, the value of PS2) is issued.
Input/Output.
Before a command is executed, its input and output may be redirected using
6 Intergraph Corporation - 2/94
sh(1) CLIX sh(1)
a special notation interpreted by the shell. The following may appear
anywhere in a simple-command or may precede or follow a command and are
not passed on to the invoked command. Note that parameter and command
substitution occurs before word or digit is used.
<word Use file word as stdin (file descriptor 0).
>word Use file word as stdout (file descriptor 1). If the file does
not exist then it is created.
>>word Use file word as stdout. If the file exists then output is
appended to it (by first seeking to the end-of-file);
otherwise, the file is created.
<<[-]word After parameter and command substitution is done on word, the
shell input is read up to the first line that literally
matches the resulting word, or to an end-of-file. If,
however, - is appended to <<:
1. leading tabs are stripped from word before the shell input
is read (but after parameter and command substitution is
done on word)
2. leading tabs are stripped from the shell input as it is
read and before each line is compared with word
3. shell input is read up to the first line that literally
matches the resulting word, or to an end-of-file.
If any character of word is quoted (see Quoting, later), no additional
processing is done to the shell input. If no characters of word are
quoted:
1. parameter and command substitution occurs,
2. (escaped) \newline is ignored, and
3. \ must be used to quote the characters \, $, and `.
The resulting document becomes stdin. Use the file associated with file
descriptor digit as stdin. Similarly for stdout using >&digit. stdin is
closed. Similarly for stdout using >&-.
If one of the above is preceded by a digit, then the file descriptor
number referred to is that specified by the digit (instead of the default
0 or 1). For example:
... 2>&1
means file descriptor 2 is to be opened for writing as a duplicate of file
descriptor 1.
2/94 - Intergraph Corporation 7
sh(1) CLIX sh(1)
The order in which redirections are specified is significant. The shell
evaluates each redirection in terms of the (file descriptor, file)
association at the time of evaluation. For example:
... 1>fname 2>&1
first associates file descriptor 1 with file fname. It then associates
file descriptor 2 with the file associated with file descriptor 1 (that
is, fname). If the order of redirections were reversed, file descriptor 2
would be associated with the terminal (assuming file descriptor 1 had
been) and then file descriptor 1 would be associated with file fname.
Using the terminology introduced under Commands, if a command is composed
of several simple commands, redirection will be evaluated for the entire
command before it is evaluated for each simple command. The shell
evaluates redirection for the entire list, then each pipeline within the
list, then each command within each pipeline, then each list within each
command.
If a command is followed by &, then the default stdin 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.
Redirection of output is not allowed in the restricted shell.
Environment.
The environment (see environ(4)) is a list of name-value pairs that is
passed to an executed program in the same way as a normal argument list.
The shell interacts with the environment in several ways. On invocation,
the shell scans the environment and creates a variable for each name
found, giving it the corresponding value and marking it export. If the
user modifies the values of these variables or creates new ones, none of
these affects the environment unless the export command is used to bind
the shell's parameter to the environment (see also set). A parameter may
be removed from the environment with the unset command. The environment
seen by any executed command is thus composed of any name-value pairs
originally inherited by the shell, minus any pairs removed by unset, plus
any modifications or additions, all of which must be noted in export
commands.
The environment for any simple-command may be augmented by prefixing it
with one or more variable assignments. Thus:
TERM=450 cmd
and
(export TERM; TERM=450; cmd)
8 Intergraph Corporation - 2/94
sh(1) CLIX sh(1)
are equivalent (as far as the above execution of cmd is concerned).
If the -k flag is set, all variable assignment arguments are placed in the
environment, even if they occur after the command name. The following
first displays a=b c and then c:
echo a=b c
set -k
echo a=b c
Signals.
The INT and QUIT signals for an invoked command are ignored if the command
is followed by &. Otherwise, signals have the values inherited by the
shell from its parent, with the exception of signal 11 (but see also the
trap command below).
Execution.
Each time a command is executed, the above substitutions are carried out.
If the command name matches one of the Special Commands listed below, it
is executed within the current shell process. If the command name does
not match a special command, but matches the name of a defined function,
the function is executed in the shell process (note how this differs from
the execution of shell procedures). The positional parameters $1, $2, ...
are set to the arguments of the function. If a command name is not a
special command or a user defined function, a process is created and an
attempt is made to execute the command with exec(2).
The shell variable PATH defines the search path for the directory
containing the command. Alternative directory names are separated by a
colon (:). The default path is :/bin:/usr/bin (specifying the current
directory, /bin, /usr/bin, in that order). Note that the current
directory is specified by a null pathname, which can appear immediately
after the equal sign, between two colon (:) delimiters anywhere in the
path list, or at the end of the path list. If the command name contains a
slash (/), the search path is not used; such commands will not be executed
by the restricted shell. Otherwise, each directory in the path is
searched for an executable file. If the file has execute permission but
is not an a.out file, it is assumed to be a file containing shell
commands. A sub-shell is spawned to read it. A parenthesized command is
executed in a sub-shell without removing nonexported quantities.
The location in the search path where a command was found is remembered by
the shell (to help avoid unnecessary exec commands later). If the command
was found in a relative directory, its location must be re-determined
whenever the current directory changes. The shell forgets all remembered
locations whenever the PATH variable is changed or the hash -r command is
executed (see below).
2/94 - Intergraph Corporation 9
sh(1) CLIX sh(1)
Special Commands.
The following simple-commands are executed in the shell process.
Input/output redirection is permitted. Unless otherwise indicated, the
output is written on file descriptor 1.
: No effect. The command does nothing; a zero exit code is returned.
.file Read and execute the commands from file and return. The search
path specified by PATH is used to find the directory containing
file.
break [n]
Exit from the enclosing for or while, loop, if any. If n is
specified then break n levels.
continue [n]
Resume the next iteration of the enclosing for, or while, loop. If
n is specified then resume at the n-th enclosing loop.
cd [arg]
Changes the current directory to arg. The shell variable HOME is
the default arg. The shell variable CDPATH defines the search path
for the directory containing arg. Alternative directory names are
separated by a colon (:). The default path is <null> (specifying
the current directory). Note that the current directory is
specified by a null pathname, which can appear immediately after
the equal sign or between the colon delimiters anywhere else in the
path list. If arg begins with a / then the search path is not
used. Otherwise, each directory in the path is searched for arg.
The cd command may not be executed by rsh.
echo [arg ... ]
Echo argument. See echo(1) for usage and description.
eval [arg ... ]
The arguments are read as input to the shell and the resulting
command(s) executed.
exec [arg ... ]
If arg is given, the command specified by the arguments is executed
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 the effect of this command is to modify
file descriptors as prescribed by the input/output redirection
list.
exit [n]
Causes the shell to exit with the exit status specified by n. If n
is omitted then the exit status is that of the last command
10 Intergraph Corporation - 2/94
sh(1) CLIX sh(1)
executed. An end-of-file will also cause the shell to exit.
export [name ...]
The given names are marked for automatic export to the environment
of subsequently-executed commands. If no arguments are given,
variable names that have been marked for export during the current
shell's execution are listed. (Variable names exported from a
parent shell are listed only if they have been exported again
during the current shell's execution.) Function names are not
exported.
getopts
Use in shell scripts to support command syntax standards (see
intro); it parses positional parameters and checks for legal flags.
See getopts for usage and description.
hash [-r] [name ... ]
For each name, the location in the search path of the command
specified by name is determined and remembered by the shell. The
-r flag causes the shell to forget all remembered locations. If no
arguments are given, information about remembered commands is
presented. Hits is the number of times a command has been invoked
by the shell process. Cost is a measure of the work required to
locate a command in the search path. If a command is found in a
``relative'' directory in the search path, after changing to that
directory, the stored location of that command is recalculated.
Commands for which this will be done are indicated by an asterisk
(*) adjacent to the hits information. Cost will be incremented
when the recalculation is done.
newgrp [arg ... ]
Equivalent to exec /bin/newgrp arg ... . See newgrp for usage and
description.
pwd Display the current working directory. See pwd for usage and
description.
read [name ... ]
One line is read and is broken up into fields using the characters
in IFS field is assigned to the first name, the second field to the
second name, and so on, with leftover fields assigned to the last
name. Lines can be continued using \newline. Characters other
than newline can be quoted by preceding them with a backslash.
These backslashes are removed before words are assigned to names,
and no interpretation is done on the character that follows the
backslash. The exit status is 0 unless an end-of-file is
encountered.
readonly [name ... ]
The given names are marked readonly and these names cannot be
changed by subsequent assignment. (If no arguments are given, a
2/94 - Intergraph Corporation 11
sh(1) CLIX sh(1)
list of all readonly names is displayed).
return [n]
Causes a shell function to return to the invoking script with the
return status specified by n. If n is omitted then the return
status is that of the last command executed.
set [+aefhkntuvx] [arg ... ]]
The flags for this command have meaning as follows:
-a Mark variables that are modified or created for export.
-e If a command has a nonzero exit status, exit immediately.
-f Disables filename generation.
-h Locate and remember function commands as functions are defined
(function commands are normally located when the function is
executed).
-k All variable assignment arguments are placed in the
environment for a command, not just those that precede the
command name.
-n Read commands but do not execute them.
-t Exit after reading and executing one command.
-u Treat unset parameters as an error when substituting.
-v Display shell input lines as they are read.
-x Display commands and their arguments as they are executed.
-- Do not change any of the flags; useful in setting $1 to a
value beginning with -.
Using + rather than - causes these flags to be turned off. These
flags can also be used upon invocation of the shell. The current
set of flags may be found in $-. The remaining arguments are
positional parameters and are assigned, in order, to $1 $2 ... .
If no arguments are given then the names and values of all
variables are displayed on stdout.
shift [n]
The positional parameters from $n+1 ... are renamed $1 ... ,
default n is 1.
text Evaluate conditional expressions. See test for usage and
description.
12 Intergraph Corporation - 2/94
sh(1) CLIX sh(1)
times Display the accumulated user and system times for the shell and for
processes run from the shell.
trap [arg] [sig ... ]
The command arg is to be read and executed when the shell receives
signal(s) sig. (Note that arg is scanned once when the trap is set
and once when the trap is taken.) Trap commands are executed in
order of signal number. Any attempt to set a trap on a signal that
was ignored on entry to the current shell is ineffective. An
attempt to trap on signal 11 (memory fault) produces an error. If
arg is omitted, then the trap(s) for each sig are reset to their
original values. If arg is the null string then this signal is
ignored by the shell and by the commands it invokes. If sig is 0
then the command arg is executed on exit from the shell. The trap
command with no arguments displays a list of commands associated
with each signal number.
type [name]
For each name, indicate how it would be interpreted if used as a
command name.
ulimit [n]
Impose a size limit of n blocks on files written by the shell and
its child processes (files of any size may be read). If n is
omitted, the current limit is displayed. You may lower your own
ulimit, but only a superuser (see su) can raise a ulimit.
umask [mask]
The user file-creation mask is set to mask (see umask). If mask is
omitted, the current value of the mask is displayed.
unset name ...
For each name, remove the corresponding variable or function. The
variables PATH, PS1, PS2, MAILCHECK, and IFS cannot be unset.
wait [job]
Wait for the specified job and report its termination status. If
job is omitted, all currently active child processes are waited
for. The exit status from this command is that of the process
waited for.
Invocation.
If the shell is invoked by exec(2), and the first character of argument
zero ($0) is -, then the shell is assumed to be a login shell and commands
are read from /etc/profile and then from $HOME/.profile, if either file
exists. Commands are then read as described below, which is also the case
when the shell is invoked as /bin/sh. The flags below are interpreted by
the shell on invocation only. Note that unless the -c or -s flag is
specified, the first argument is assumed to be the name of a file
containing commands, and the remaining arguments are passed as positional
2/94 - Intergraph Corporation 13
sh(1) CLIX sh(1)
parameters to that command file:
-c string If the -c flag is present then commands are read from string.
-s If the -s flag is present or if no arguments remain then
commands are read from stdin. Any remaining arguments specify
the positional parameters. Shell output, except for the
output of the Special Commands listed above, is written to
file descriptor 2.
-i If the -i flag is present or if the shell input and output are
attached to a terminal, this shell is interactive. In this
case TERM is ignored (so that kill 0 does not kill an
interactive shell) and INTR is caught and ignored (so that
wait is interruptible). In all cases, QUIT is ignored by the
shell.
-r If the -r flag is present the shell is a restricted shell.
The remaining flags and arguments are described under the set command
above.
Rsh Only.
The rsh is used to set up login names and execution environments whose
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
disallowed:
⊕ changing directory (see cd(1))
⊕ setting the value of PATH
⊕ specifying path or command names containing /
⊕ redirecting output (> and >>).
The restrictions above are enforced after .profile is interpreted.
A restricted shell can be invoked in one of the following ways:
1. rsh is the filename part of the last entry in the /etc/passwd file
(see passwd)
2. the environment variable SHELL exists and rsh is the filename part of
its value
3. the shell is invoked and rsh is the filename part of argument 0
4. the shell is invoked with the -r flag
14 Intergraph Corporation - 2/94
sh(1) CLIX sh(1)
When a command to be executed is found to be a shell procedure, rsh
invokes sh to execute it. Thus, it is possible to provide to the end-user
shell procedures that have access to the full power of the standard shell,
while imposing a limited menu of commands; this scheme assumes that the
end-user does not have write and execute permissions in the same
directory.
The net effect of these rules is that the writer of the .profile has
complete control over user actions, by performing guaranteed setup actions
and leaving the user in an appropriate directory (probably not the login
directory).
The system administrator often sets up a directory of commands (that is,
/usr/rbin) that can be safely invoked by rsh.
FILES
/etc/profile
$HOME/.profile
/tmp/sh*
/dev/null
NOTES
If a command is executed, and then 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 exec the original
command. Use the hash 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 pathname to correct this
situation.
Not all the processes of a 3- or more-stage pipeline are children of the
shell, and thus cannot be waited for.
For wait n, if n is not an active process ID, all your shell's current
background processes are waited for and the return code will be 0.
CAUTIONS
Words used for filenames in input/output are not interpreted for filename
generation (see Filename Generation, above). For example, the command:
cat file1 >a*
will create a file named a*.
2/94 - Intergraph Corporation 15
sh(1) CLIX sh(1)
Because commands in pipelines are run as separate processes, variables set
in a pipeline have no effect on the parent shell.
If you get the error message:
cannot fork, too many processes
try using the wait command to clean up your background processes. If this
doesn't help, the system process table is probably full or you have too
many foreground processes. There is a limit to the number of process ids
associated with your login, and to the number the system can keep track
of.
EXIT VALUES
Errors detected by the shell, such as syntax errors, cause the shell to
return a nonzero exit status. If the shell is being used noninteractively
then execution of the shell file is abandoned. Otherwise, the shell
returns the exit status of the last command executed.
RELATED INFORMATION
Commands: cd(1), echo(1), env(1), getopts(1), intro(1), login(1),
newgrp(8), test(1), umask(1), wait(1)
Functions: dup(2), exec(2), fork(2), pipe(2), signal(2), umask(2),
ulimit(2)
Files: profile(4)
Miscellany: environ(4)
16 Intergraph Corporation - 2/94