BSD 4_3_Tahoe development
[unix-history] / usr / man / cat1 / for.0
SH(1) UNIX Programmer's Manual SH(1)
N\bNA\bAM\bME\bE
sh, for, case, if, while, :\b:, .\b., break, continue, cd, eval,
exec, exit, export, login, read, readonly, set, shift,
times, trap, umask, wait - command language
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
s\bsh\bh [ -\b-c\bce\bei\bik\bkn\bnr\brs\bst\btu\buv\bvx\bx ] [ arg ] ...
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
_\bS_\bh is a command programming language that executes commands
read from a terminal or a file. See i\bin\bnv\bvo\boc\bca\bat\bti\bio\bon\bn for the
meaning of arguments to the shell.
C\bCo\bom\bmm\bma\ban\bnd\bds\bs.\b.
A _\bs_\bi_\bm_\bp_\bl_\be-_\bc_\bo_\bm_\bm_\ba_\bn_\bd is a sequence of non blank _\bw_\bo_\br_\bd_\bs separated
by blanks (a blank is a t\bta\bab\bb or a s\bsp\bpa\bac\bce\be). 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 argu-
ment 0 (see _\be_\bx_\be_\bc_\bv_\be(2)). The _\bv_\ba_\bl_\bu_\be of a simple-command is
its exit status if it terminates normally or 200+_\bs_\bt_\ba_\bt_\bu_\bs if
it terminates abnormally (see _\bs_\bi_\bg_\bv_\be_\bc(2) for a list of status
values).
A _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be is a sequence of one or more _\bc_\bo_\bm_\bm_\ba_\bn_\bd_\bs separated
by |\b|.\b. The standard output of each command but the last is
connected by a _\bp_\bi_\bp_\be(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.
A _\bl_\bi_\bs_\bt is a sequence of one or more _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be_\bs separated by
;\b;, &\b&, &\b&&\b& or |\b||\b| and optionally terminated by ;\b; or &\b&. ;\b; and &\b&
have equal precedence which is lower than that of &\b&&\b& and |\b||\b|,
&\b&&\b& and |\b||\b| also have equal precedence. A semicolon causes
sequential execution; an ampersand causes the preceding
_\bp_\bi_\bp_\be_\bl_\bi_\bn_\be to be executed without waiting for it to finish.
The symbol &\b&&\b& (|\b||\b|) causes the _\bl_\bi_\bs_\bt following to be executed
only if the preceding _\bp_\bi_\bp_\be_\bl_\bi_\bn_\be returns a zero (non zero)
value. Newlines may appear in a _\bl_\bi_\bs_\bt, instead of semi-
colons, to delimit commands.
A _\bc_\bo_\bm_\bm_\ba_\bn_\bd is either a simple-command or one of the follow-
ing. The value returned by a command is that of the last
simple-command executed in the command.
f\bfo\bor\br _\bn_\ba_\bm_\be [i\bin\bn _\bw_\bo_\br_\bd ...] d\bdo\bo _\bl_\bi_\bs_\bt d\bdo\bon\bne\be
Each time a f\bfo\bor\br command is executed _\bn_\ba_\bm_\be is set to the
next word in the f\bfo\bor\br word list. If i\bin\bn _\bw_\bo_\br_\bd ... is
omitted, i\bin\bn "\b"$\b$@\b@"\b" is assumed. Execution ends when there
are no more words in the list.
c\bca\bas\bse\be _\bw_\bo_\br_\bd i\bin\bn [_\bp_\ba_\bt_\bt_\be_\br_\bn [ |\b| _\bp_\ba_\bt_\bt_\be_\br_\bn ] ... )\b) _\bl_\bi_\bs_\bt ;\b;;\b;] ... e\bes\bsa\bac\bc
Printed 7/9/88 May 5, 1986 1
SH(1) UNIX Programmer's Manual SH(1)
A c\bca\bas\bse\be command executes the _\bl_\bi_\bs_\bt associated with the
first pattern that matches _\bw_\bo_\br_\bd. The form of the pat-
terns is the same as that used for file name genera-
tion.
i\bif\bf _\bl_\bi_\bs_\bt t\bth\bhe\ben\bn _\bl_\bi_\bs_\bt [e\bel\bli\bif\bf _\bl_\bi_\bs_\bt t\bth\bhe\ben\bn _\bl_\bi_\bs_\bt] ... [e\bel\bls\bse\be _\bl_\bi_\bs_\bt] f\bfi\bi
The _\bl_\bi_\bs_\bt following i\bif\bf is executed and if it returns
zero the _\bl_\bi_\bs_\bt following t\bth\bhe\ben\bn is executed. Otherwise,
the _\bl_\bi_\bs_\bt following e\bel\bli\bif\bf is executed and if its value is
zero the _\bl_\bi_\bs_\bt following t\bth\bhe\ben\bn is executed. Failing that
the e\bel\bls\bse\be _\bl_\bi_\bs_\bt is executed.
w\bwh\bhi\bil\ble\be _\bl_\bi_\bs_\bt [d\bdo\bo _\bl_\bi_\bs_\bt] d\bdo\bon\bne\be
A w\bwh\bhi\bil\ble\be command repeatedly executes the w\bwh\bhi\bil\ble\be _\bl_\bi_\bs_\bt and
if its value is zero executes the d\bdo\bo _\bl_\bi_\bs_\bt; otherwise
the loop terminates. The value returned by a w\bwh\bhi\bil\ble\be
command is that of the last executed command in the d\bdo\bo
_\bl_\bi_\bs_\bt. u\bun\bnt\bti\bil\bl may be used in place of w\bwh\bhi\bil\ble\be to negate the
loop termination test.
(\b( _\bl_\bi_\bs_\bt )\b)
Execute _\bl_\bi_\bs_\bt in a subshell.
{\b{ _\bl_\bi_\bs_\bt }\b}
_\bl_\bi_\bs_\bt is simply executed.
The following words are only recognized as the first word of
a command and when not quoted.
i\bif\bf t\bth\bhe\ben\bn e\bel\bls\bse\be e\bel\bli\bif\bf f\bfi\bi c\bca\bas\bse\be i\bin\bn e\bes\bsa\bac\bc f\bfo\bor\br w\bwh\bhi\bil\ble\be u\bun\bnt\bti\bil\bl d\bdo\bo
d\bdo\bon\bne\be {\b{ }\b}
C\bCo\bom\bmm\bma\ban\bnd\bd s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn.\b.
The standard output from a command enclosed in a pair of
back quotes (`\b``\b`) may be used as part or all of a word;
trailing newlines are removed.
P\bPa\bar\bra\bam\bme\bet\bte\ber\br s\bsu\bub\bbs\bst\bti\bit\btu\but\bti\bio\bon\bn.\b.
The character $\b$ is used to introduce substitutable parame-
ters. Positional parameters may be assigned values by s\bse\bet\bt.
Variables may be set by writing
_\bn_\ba_\bm_\be=\b=_\bv_\ba_\bl_\bu_\be [ _\bn_\ba_\bm_\be=\b=_\bv_\ba_\bl_\bu_\be ] ...
${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br}\b}
A _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is a sequence of letters, digits or under-
scores (a _\bn_\ba_\bm_\be), a digit, or any of the characters *\b* @\b@
#\b# ?\b? -\b- $\b$ !\b!.\b. The value, if any, of the parameter is sub-
stituted. The braces are required only when _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br
is followed by a letter, digit, or underscore that is
not to be interpreted as part of its name. If _\bp_\ba_\br_\ba_\bm_\be_\b-
_\bt_\be_\br is a digit, it is a positional parameter. If
Printed 7/9/88 May 5, 1986 2
SH(1) UNIX Programmer's Manual SH(1)
_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is *\b* or @\b@ then all the positional parameters,
starting with $\b$1\b1, are substituted separated by spaces.
$\b$0\b0 is set from argument zero when the shell is invoked.
${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br-_\bw_\bo_\br_\bd}\b}
If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is set, substitute its value; otherwise
substitute _\bw_\bo_\br_\bd.
${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br=_\bw_\bo_\br_\bd}\b}
If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is not set, set it to _\bw_\bo_\br_\bd; the value of
the parameter is then substituted. Positional parame-
ters may not be assigned to in this way.
${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br?_\bw_\bo_\br_\bd}\b}
If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is set, substitute its value; otherwise,
print _\bw_\bo_\br_\bd and exit from the shell. If _\bw_\bo_\br_\bd is omit-
ted, a standard message is printed.
${\b{_\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br+_\bw_\bo_\br_\bd}\b}
If _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br is set, substitute _\bw_\bo_\br_\bd; otherwise substi-
tute nothing.
In the above _\bw_\bo_\br_\bd is not evaluated unless it is to be used
as the substituted string. (So that, for example, echo
${d-'pwd'} will only execute _\bp_\bw_\bd if _\bd is unset.)
The following _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br_\bs are automatically set by the shell.
#\b# The number of positional parameters in decimal.
-\b- Options supplied to the shell on invocation or by
s\bse\bet\bt.
?\b? The value returned by the last executed command in
decimal.
$\b$ The process number of this shell.
!\b! The process number of the last background command
invoked.
The following _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br_\bs are used but not set by the shell.
H\bHO\bOM\bME\bE The default argument (home directory) for the c\bcd\bd
command.
P\bPA\bAT\bTH\bH The search path for commands (see e\bex\bxe\bec\bcu\but\bti\bio\bon\bn).
M\bMA\bAI\bIL\bL If this variable is set to the name of a mail
file, the shell informs the user of the arrival of
mail in the specified file.
P\bPS\bS1\b1 Primary prompt string, by default '$ '.
P\bPS\bS2\b2 Secondary prompt string, by default '> '.
I\bIF\bFS\bS Internal field separators, normally s\bsp\bpa\bac\bce\be, t\bta\bab\bb,
and n\bne\bew\bwl\bli\bin\bne\be. I\bIF\bFS\bS is ignored if _\bs_\bh is running as
root or if the effective user id differs from the
real user id.
Printed 7/9/88 May 5, 1986 3
SH(1) UNIX Programmer's Manual SH(1)
B\bBl\bla\ban\bnk\bk i\bin\bnt\bte\ber\brp\bpr\bre\bet\bta\bat\bti\bio\bon\bn.\b.
After parameter and command substitution, any results of
substitution are scanned for internal field separator char-
acters (those found in $\b$I\bIF\bFS\bS) and split into distinct argu-
ments where such characters are found. Explicit null argu-
ments ("" or '') are retained. Implicit null arguments
(those resulting from _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br_\bs that have no values) are
removed.
F\bFi\bil\ble\be n\bna\bam\bme\be g\bge\ben\bne\ber\bra\bat\bti\bio\bon\bn.\b.
Following substitution, each command word is scanned for the
characters *\b*, ?\b? and [\b[.\b. If one of these characters appears,
the word is regarded as a pattern. The word is replaced
with alphabetically sorted file names that match the pat-
tern. If no file name is found that matches the pattern,
the word is left unchanged. The character .\b. at the start of
a file name or immediately following a /\b/, and the character
/\b/, must be matched explicitly.
*\b* Matches any string, including the null string.
?\b? Matches any single character.
[\b[.\b..\b..\b.]\b]
Matches any one of the characters enclosed. A pair of
characters separated by -\b- matches any character lexi-
cally between the pair.
Q\bQu\buo\bot\bti\bin\bng\bg.\b.
The following characters have a special meaning to the shell
and cause termination of a word unless quoted.
;\b; &\b& (\b( )\b) |\b| <\b< >\b> n\bne\bew\bwl\bli\bin\bne\be s\bsp\bpa\bac\bce\be t\bta\bab\bb
A character may be _\bq_\bu_\bo_\bt_\be_\bd by preceding it with a \\b\.\b. \\b\n\bne\bew\bw-\b-
l\bli\bin\bne\be is ignored. All characters enclosed between a pair of
quote marks ('\b''\b'), except a single quote, are quoted. Inside
double quotes ("\b""\b") parameter and command substitution occurs
and \\b\ quotes the characters \\b\ '\b' "\b" and $\b$.
"\b"$\b$*\b*"\b" is equivalent to "\b"$\b$1\b1 $\b$2\b2 .\b..\b..\b."\b" whereas
"\b"$\b$@\b@"\b" is equivalent to "\b"$\b$1\b1"\b" "\b"$\b$2\b2"\b" .\b..\b..\b. .\b.
P\bPr\bro\bom\bmp\bpt\bti\bin\bng\bg.\b.
When used interactively, the shell prompts with the value of
PS1 before reading a command. If at any time a newline is
typed and further input is needed to complete a command, the
secondary prompt ($\b$P\bPS\bS2\b2) is issued.
I\bIn\bnp\bpu\but\bt o\bou\but\btp\bpu\but\bt.\b.
Before a command is executed its input and output may be
redirected using a special notation interpreted by the
shell. The following may appear anywhere in a simple-
command or may precede or follow a _\bc_\bo_\bm_\bm_\ba_\bn_\bd and are not
Printed 7/9/88 May 5, 1986 4
SH(1) UNIX Programmer's Manual SH(1)
passed on to the invoked command. Substitution occurs
before _\bw_\bo_\br_\bd or _\bd_\bi_\bg_\bi_\bt is used.
<_\bw_\bo_\br_\bd
Use file _\bw_\bo_\br_\bd as standard input (file descriptor 0).
>_\bw_\bo_\br_\bd
Use file _\bw_\bo_\br_\bd as standard output (file descriptor 1).
If the file does not exist, it is created; otherwise it
is truncated to zero length.
>>_\bw_\bo_\br_\bd
Use file _\bw_\bo_\br_\bd as standard output. If the file exists,
output is appended (by seeking to the end); otherwise
the file is created.
<<_\bw_\bo_\br_\bd
The shell input is read up to a line the same as _\bw_\bo_\br_\bd,
or end of file. The resulting document becomes the
standard input. If any character of _\bw_\bo_\br_\bd is quoted, no
interpretation is placed upon the characters of the
document; otherwise, parameter and command substitution
occurs, \\b\n\bne\bew\bwl\bli\bin\bne\be is ignored, and \\b\ is used to quote the
characters \\b\ $\b$ '\b' and the first character of _\bw_\bo_\br_\bd.
<&_\bd_\bi_\bg_\bi_\bt
The standard input is duplicated from file descriptor
_\bd_\bi_\bg_\bi_\bt; see _\bd_\bu_\bp(2). Similarly for the standard output
using >.
<&- The standard input is closed. Similarly for the stan-
dard output using >.
If one of the above is preceded by a digit, the file
descriptor created is that specified by the digit (instead
of the default 0 or 1). For example,
... 2>&1
creates file descriptor 2 to be a duplicate of file descrip-
tor 1.
If a command is followed by &\b& then the default standard
input for the command is the empty file (/dev/null). Other-
wise, the environment for the execution of a command con-
tains the file descriptors of the invoking shell as modified
by input output specifications.
E\bEn\bnv\bvi\bir\bro\bon\bnm\bme\ben\bnt\bt.\b.
The environment is a list of name-value pairs that is passed
to an executed program in the same way as a normal argument
list; see _\be_\bx_\be_\bc_\bv_\be(2) and _\be_\bn_\bv_\bi_\br_\bo_\bn(7). The shell interacts
Printed 7/9/88 May 5, 1986 5
SH(1) UNIX Programmer's Manual SH(1)
with the environment in several ways. On invocation, the
shell scans the environment and creates a _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br for each
name found, giving it the corresponding value. Executed
commands inherit the same environment. If the user modifies
the values of these _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br_\bs or creates new ones, none of
these affects the environment unless the e\bex\bxp\bpo\bor\brt\bt command is
used to bind the shell's _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br to the environment. The
environment seen by any executed command is thus composed of
any unmodified name-value pairs originally inherited by the
shell, plus any modifications or additions, all of which
must be noted in e\bex\bxp\bpo\bor\brt\bt commands.
The environment for any _\bs_\bi_\bm_\bp_\bl_\be-_\bc_\bo_\bm_\bm_\ba_\bn_\bd may be augmented by
prefixing it with one or more assignments to _\bp_\ba_\br_\ba_\bm_\be_\bt_\be_\br_\bs.
Thus these two lines are equivalent
TERM=450 cmd args
(export TERM; TERM=450; cmd args)
If the -\b-k\bk flag is set, _\ba_\bl_\bl keyword arguments are placed in
the environment, even if the occur after the command name.
The following prints 'a=b c' and 'c':
echo a=b c
set -k
echo a=b c
S\bSi\big\bgn\bna\bal\bls\bs.\b.
The INTERRUPT and QUIT signals for an invoked command are
ignored if the command is followed by &\b&; otherwise signals
have the values inherited by the shell from its parent.
(But see also t\btr\bra\bap\bp.\b.)
E\bEx\bxe\bec\bcu\but\bti\bio\bon\bn.\b.
Each time a command is executed the above substitutions are
carried out. Except for the 'special commands' listed below
a new process is created and an attempt is made to execute
the command via an _\be_\bx_\be_\bc_\bv_\be(2).
The shell parameter $\b$P\bPA\bAT\bTH\bH defines the search path for the
directory containing the command. Each alternative direc-
tory name is separated by a colon (:\b:). The default path is
:\b:/\b/b\bbi\bin\bn:\b:/\b/u\bus\bsr\br/\b/b\bbi\bin\bn. If the command name contains a /, the
search path is not used. Otherwise, each directory in the
path is searched for an executable file. If the file has
execute permission but is not an _\ba._\bo_\bu_\bt file, it is assumed
to be a file containing shell commands. A subshell (i.e., a
separate process) is spawned to read it. A parenthesized
command is also executed in a subshell.
S\bSp\bpe\bec\bci\bia\bal\bl c\bco\bom\bmm\bma\ban\bnd\bds\bs.\b.
The following commands are executed in the shell process and
except where specified no input output redirection is
Printed 7/9/88 May 5, 1986 6
SH(1) UNIX Programmer's Manual SH(1)
permitted for such commands.
#\b# For non-interactive shells, everything following the #\b#
is treated as a comment, i.e. the rest of the line is
ignored. For interactive shells, the #\b# has no special
effect.
:\b: No effect; the command does nothing.
.\b. _\bf_\bi_\bl_\be
Read and execute commands from _\bf_\bi_\bl_\be and return. The
search path $\b$P\bPA\bAT\bTH\bH is used to find the directory con-
taining _\bf_\bi_\bl_\be.
b\bbr\bre\bea\bak\bk [_\bn]
Exit from the enclosing f\bfo\bor\br or w\bwh\bhi\bil\ble\be loop, if any. If
_\bn is specified, break _\bn levels.
c\bco\bon\bnt\bti\bin\bnu\bue\be [_\bn]
Resume the next iteration of the enclosing f\bfo\bor\br or w\bwh\bhi\bil\ble\be
loop. If _\bn is specified, resume at the _\bn-th enclosing
loop.
c\bcd\bd [_\ba_\br_\bg]
Change the current directory to _\ba_\br_\bg. The shell parame-
ter $\b$H\bHO\bOM\bME\bE is the default _\ba_\br_\bg.
e\bev\bva\bal\bl [_\ba_\br_\bg ...]
The arguments are read as input to the shell and the
resulting command(s) executed.
e\bex\bxe\bec\bc [_\ba_\br_\bg ...]
The command specified by the arguments is executed in
place of this shell without creating a new process.
Input output arguments may appear and if no other argu-
ments are given cause the shell input output to be
modified.
e\bex\bxi\bit\bt [_\bn]
Causes a non interactive shell to exit with the exit
status specified by _\bn. If _\bn is omitted, the exit status
is that of the last command executed. (An end of file
will also exit from the shell.)
e\bex\bxp\bpo\bor\brt\bt [_\bn_\ba_\bm_\be ...]
The given names are marked for automatic export to the
_\be_\bn_\bv_\bi_\br_\bo_\bn_\bm_\be_\bn_\bt of subsequently-executed commands. If no
arguments are given, a list of exportable names is
printed.
l\blo\bog\bgi\bin\bn [_\ba_\br_\bg ...]
Equivalent to 'exec login arg ...'.
r\bre\bea\bad\bd _\bn_\ba_\bm_\be ...
One line is read from the standard input; successive
words of the input are assigned to the variables _\bn_\ba_\bm_\be
in order, with leftover words to the last variable.
The return code is 0 unless the end-of-file is encoun-
tered.
r\bre\bea\bad\bdo\bon\bnl\bly\by [_\bn_\ba_\bm_\be ...]
The given names are marked readonly and the values of
the these names may not be changed by subsequent
Printed 7/9/88 May 5, 1986 7
SH(1) UNIX Programmer's Manual SH(1)
assignment. If no arguments are given, a list of all
readonly names is printed.
s\bse\bet\bt [-\b-e\bek\bkn\bnp\bpt\btu\buv\bvx\bx [_\ba_\br_\bg ...]]
-\b-e\be If non interactive, exit immediately if a command
fails.
-\b-k\bk All keyword arguments are placed in the environment
for a command, not just those that precede the com-
mand name.
-\b-n\bn Read commands but do not execute them.
-\b-t\bt Exit after reading and executing one command.
-\b-u\bu Treat unset variables as an error when substituting.
-\b-v\bv Print shell input lines as they are read.
-\b-x\bx Print commands and their arguments as they are exe-
cuted.
-\b- Turn off the -\b-x\bx and -\b-v\bv options.
These flags can also be used upon invocation of the
shell. The current set of flags may be found in $\b$-\b-.
Remaining arguments are positional parameters and are
assigned, in order, to $\b$1\b1, $\b$2\b2, etc. If no arguments
are given, the values of all names are printed.
s\bsh\bhi\bif\bft\bt
The positional parameters from $\b$2\b2... are renamed $\b$1\b1...
t\bti\bim\bme\bes\bs
Print the accumulated user and system times for
processes run from the shell.
t\btr\bra\bap\bp [_\ba_\br_\bg] [_\bn] ...
_\bA_\br_\bg is a command to be read and executed when the shell
receives signal(s) _\bn. (Note that _\ba_\br_\bg is scanned once
when the trap is set and once when the trap is taken.)
Trap commands are executed in order of signal number.
If _\ba_\br_\bg is absent, all trap(s) _\bn are reset to their ori-
ginal values. If _\ba_\br_\bg is the null string, this signal
is ignored by the shell and by invoked commands. If _\bn
is 0, the command _\ba_\br_\bg is executed on exit from the
shell, otherwise upon receipt of signal _\bn as numbered
in _\bs_\bi_\bg_\bv_\be_\bc(2). _\bT_\br_\ba_\bp with no arguments prints a list of
commands associated with each signal number.
u\bum\bma\bas\bsk\bk [ _\bn_\bn_\bn ]
The user file creation mask is set to the octal value
_\bn_\bn_\bn (see _\bu_\bm_\ba_\bs_\bk(2)). If _\bn_\bn_\bn is omitted, the current
value of the mask is printed.
w\bwa\bai\bit\bt [_\bn]
Wait for the specified process and report its termina-
tion status. If _\bn is not given, all currently active
child processes are waited for. The return code from
Printed 7/9/88 May 5, 1986 8
SH(1) UNIX Programmer's Manual SH(1)
this command is that of the process waited for.
I\bIn\bnv\bvo\boc\bca\bat\bti\bio\bon\bn.\b.
If the first character of argument zero is -\b-, commands are
read from $\b$H\bHO\bOM\bME\bE/\b/.\b.p\bpr\bro\bof\bfi\bil\ble\be, if such a file exists. Commands
are then read as described below. The following flags are
interpreted by the shell when it is invoked.
-\b-c\bc _\bs_\bt_\br_\bi_\bn_\bg If the -\b-c\bc flag is present, commands are read from
_\bs_\bt_\br_\bi_\bn_\bg.
-\b-s\bs If the -\b-s\bs flag is present or if no arguments
remain then commands are read from the standard
input. Shell output is written to file descrip-
tor 2.
-\b-i\bi If the -\b-i\bi flag is present or if the shell input
and output are attached to a terminal (as told by
_\bg_\bt_\bt_\by) then this shell is _\bi_\bn_\bt_\be_\br_\ba_\bc_\bt_\bi_\bv_\be. In this
case the terminate signal SIGTERM (see _\bs_\bi_\bg_\bv_\be_\bc(2))
is ignored (so that 'kill 0' does not kill an
interactive shell) and the interrupt signal SIG-
INT is caught and ignored (so that w\bwa\bai\bit\bt is inter-
ruptible). In all cases SIGQUIT is ignored by
the shell.
The remaining flags and arguments are described under the
s\bse\bet\bt command.
F\bFI\bIL\bLE\bES\bS
$HOME/.\b.profile
/tmp/sh*
/dev/null
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
csh(1), test(1), execve(2), environ(7)
D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
Errors detected by the shell, such as syntax errors cause
the shell to return a non zero exit status. If the shell is
being used non interactively then execution of the shell
file is abandoned. Otherwise, the shell returns the exit
status of the last command executed (see also e\bex\bxi\bit\bt).
B\bBU\bUG\bGS\bS
If << is used to provide standard input to an asynchronous
process invoked by &, the shell gets mixed up about naming
the input document. A garbage file /tmp/sh* is created, and
the shell complains about not being able to find the file by
another name.
Printed 7/9/88 May 5, 1986 9