1SH(1)                       General Commands Manual                      SH(1)
2
3
4

NAME

6       sh,  for, case, if, while, :, ., break, continue, cd, eval, exec, exit,
7       export, login, read, readonly, set, shift, times, trap, umask,  wait  -
8       command language
9

SYNOPSIS

11       sh [ -ceiknrstuvx ] [ arg ] ...
12

DESCRIPTION

14       Sh is a command programming language that executes commands read from a
15       terminal or a file.  See invocation for the meaning of arguments to the
16       shell.
17
18       Commands.
19       A  simple-command  is a sequence of non blank words separated by blanks
20       (a blank is a tab or a space).  The first word specifies  the  name  of
21       the  command  to  be executed.  Except as specified below the remaining
22       words are passed as arguments to the invoked command.  The command name
23       is passed as argument 0 (see execve(2)).  The value of a simple-command
24       is its exit status if it terminates normally or 200+status if it termi‐
25       nates abnormally (see sigvec(2) for a list of status values).
26
27       A  pipeline  is a sequence of one or more commands separated by |.  The
28       standard output of each command but the last is connected by a  pipe(2)
29       to  the  standard  input of the next command.  Each command is run as a
30       separate process; the shell waits for the last command to terminate.
31
32       A list is a sequence of one or more pipelines separated by ;, &, &&  or
33       ||  and optionally terminated by ; or &.  ; and & have equal precedence
34       which is lower than that of && and ||, && and || also have equal prece‐
35       dence.   A  semicolon  causes sequential execution; an ampersand causes
36       the preceding pipeline to be executed without waiting for it to finish.
37       The symbol && (||) causes the list following to be executed only if the
38       preceding pipeline returns a  zero  (non  zero)  value.   Newlines  may
39       appear in a list, instead of semicolons, to delimit commands.
40
41       A  command  is  either  a  simple-command or one of the following.  The
42       value returned by a command is that of the last simple-command executed
43       in the command.
44
45       for name [in word ...] do list done
46              Each time a for command is executed name is set to the next word
47              in the for word list.  If in word ...  is omitted,  in  "$@"  is
48              assumed.   Execution  ends  when  there are no more words in the
49              list.
50
51       case word in [pattern [ | pattern ] ... ) list ;;] ... esac
52              A case command executes the list associated with the first  pat‐
53              tern that matches word.  The form of the patterns is the same as
54              that used for file name generation.
55
56       if list then list [elif list then list] ... [else list] fi
57              The list following if is executed and if  it  returns  zero  the
58              list  following then is executed.  Otherwise, the list following
59