GNU Info

Info Node: (bashref.info)Lists

(bashref.info)Lists


Next: Looping Constructs Prev: Pipelines Up: Shell Commands
Enter node , (file) or (file)node

Lists of Commands
-----------------

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

   Of these list operators, `&&' and `||' have equal precedence,
followed by `;' and `&', which have equal precedence.

   If a command is terminated by the control operator `&', the shell
executes the command asynchronously in a subshell.  This is known as
executing the command in the BACKGROUND.  The shell does not wait for
the command to finish, and the return status is 0 (true).  When job
control is not active (Note: Job Control), the standard input for
asynchronous commands, in the absence of any explicit redirections, is
redirected from `/dev/null'.

   Commands separated by a `;' are executed sequentially; the shell
waits for each command to terminate in turn.  The return status is the
exit status of the last command executed.

   The control operators `&&' and `||' denote AND lists and OR lists,
respectively.  An AND list has the form
     COMMAND1 && COMMAND2

COMMAND2 is executed if, and only if, COMMAND1 returns an exit status
of zero.

   An OR list has the form
     COMMAND1 || COMMAND2

COMMAND2 is executed if, and only if, COMMAND1 returns a non-zero exit
status.

   The return status of AND and OR lists is the exit status of the last
command executed in the list.


automatically generated by info2www version 1.2.2.9