How do I ask "if NOT" in shell?

Richard O'Keefe ok at cs.mu.oz.au
Tue Oct 24 22:47:53 AEST 1989


When you really want to write
	unless command ; then
	    stmts
	fi
you can do it by writing
	command
	if test $? != 0 ; then # command failed
	    stmts
	fi

If stmts is sufficiently simple, you can also do
	command || { stmts }



More information about the Comp.unix.questions mailing list