How do I ask "if NOT" in shell?

Maarten Litmaath maart at cs.vu.nl
Fri Oct 27 05:14:40 AEST 1989


roe at sobmips.UUCP (r.peterson) writes:
\...
\true && {
\	echo true
\} || {
\	echo false
\}
\
\and it functions fine.  Change true && to false && and it prints false
\correctly as well.

The abovementioned method has different characteristics:

	test-command && {
		if-clause
	} || {
		else-clause
	}

...will execute the else-clause if the test-command *or* the if-clause fails,
which might not be what you want.
-- 
A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam:
 a hard link is the file system's GOTO. | maart at cs.vu.nl, mcsun!botter!maart



More information about the Comp.unix.questions mailing list