Should shell command errors abandon subsequent commands?

Morris Keesan keesan at bbncca.ARPA
Sat Jul 21 05:08:28 AEST 1984


-------------------------------

Shell command errors should NOT abandon subsequent commands, if the commands
are separated, as in the examples, by semicolons.  Semicolons should behave
exactly like newline.  This should be true regardless of whether the shell
is interactive (from the terminal) or running a script.

The separator ';' means "execute the first command, then execute the second."
The separator '&&' means "execute the first command, and if it succeeds (i.e.
    returns exit status 0) then execute the second."
The separator '||' means "execute the first command, and if it fails (returns
    non-zero exit status) then execute the second."

Given the availability of the && and || separators, there is no reason and no
excuse for the ; to imply any attention to the exit status.
-- 
			    Morris M. Keesan
			    {decvax,linus,ihnp4,wivax,wjh12,ima}!bbncca!keesan
			    keesan @ BBN-UNIX.ARPA



More information about the Comp.unix.wizards mailing list