Lists

A list is a sequence of commands separated by an ampersand (&) or a semicolon (;), and optionally terminated by a <newline>, ampersand, or semicolon. An AND-OR list is a sequence of commands separated by a && or ||. Both operators have the same priority.

Asynchronous lists

If a command is terminated by the control operator ampersand (&), qsh runs the command asynchronously. That is, qsh does not wait for the command to finish before running the next command. The format for running a command in the background is:

command1 & [ command2 & ... ]

If the interactive option is not set, the standard input of any asynchronous command is set to /dev/qsh-stdin-null. The exit status of an asynchronous list is the exit status of the last command.

Sequential lists

Commands that are separated by a semicolon (;) are run sequentially. The format for a sequential list is:

command1 [ ; command2 ... ]

The commands in the list are run in the order they are written. The exit status of a sequential list is the exit status of the last command.

AND lists

The format for an AND list is:

command1 [ && command2 ... ]

With an AND list, qsh runs command1, and then runs command2 if the exit status of the command1 is zero and so on until a command has a non-zero exit status or there are no commands left to run. The exit status of an AND list is the exit status of the last command that is run.

OR lists

The format for an OR list is:

command1 [ || command2 ... ]

With an OR list, qsh runs command1, and then runs command2 if the exit status of the command1 is non-zero and so on until a command has a zero exit status or there are no commands left to run. The exit status of an OR list is the exit status of the last command that is run.