Owner's manual

Command-Entry Aids
The following shell command-entry aids are supported by the OSS shell:
“Using Multiple Commands and Command Lists ”
“Using Pipes and Filters ”
“Grouping Commands
“Quoting
Using Multiple Commands and Command Lists
The OSS shell usually takes the first string on a command line as the name of a command and any
following strings as arguments to that command. That is, the shell usually considers each command
line as a single command. However, you can use the operators in Table 4 to execute multiple
commands on a single command line.
Table 4 Multiple Command Operators
ExampleDescriptionOperator
cmd1 ; cmd2Causes commands to run in sequence.; (semicolon)
cmd1 && cmd2Runs the next command only if the current
command succeeds.
&&
cmd1 || cmd2Runs the next command only if the current
command fails.
||
ls | wcCreates a pipeline.|
Running Commands in Sequence With a Semicolon (;)
You can type more than one command on a line if you separate commands with the ; (semicolon)
operator. In the following example, a user named amy enters a series of four commands separated
by semicolons:
$ ls ; who ; date ; pwd
change file3 newfile
amy console/1 Jun 4 14:41
Tue Jun 4 14:42:51 CDT 1997
/u/amy
In this example, the shell first runs ls. When ls is finished, the shell runs who, and then date,
and finally pwd. The four lines of output following the command line correspond to the sequence
in which the four commands ran.
To make the command line easier to read, you can separate commands from the ; (semicolon)
with blanks or tabs. The shell ignores blanks and tabs used in this way.
Running Commands Conditionally With the || and && Operators
When you connect commands with the && or || operator, the shell runs the first command and
then runs the remaining commands only under the following conditions:
With the && operator, the shell runs each command only if the previous command runs
successfully. A command indicates successful completion when it returns a value of 0 (zero).
&&
With the || operator, the shell runs each command only if the previous command fails.||
Command-Entry Aids 35