[NCLUG] csh to bash question

S. Luke Jones luke at 6d.com
Mon Feb 26 15:32:48 MST 2001


"Mark C. Smith" wrote:
> from csh to bash.  I have no idea what it does as the
> $? always screws me up.  Any help is mucho appreciated.

${?var} returns 1 if var is set, 0 otherwise
$?0 return 1 if input filename is known, 0 otherwise

so my guess is that this is csh-speak for

if [ -z "$MPIRUN_DEVICE" ]
then
	exit
fi

or, more succinctly

test -z "$MPIRUN_DEVICE" && exit
test -n "$MPIRUN_DEVICE" || exit

(I eschew the "[ test ] && whatever" syntax you see so much.)

See also Tom Christiansen's famous diatribe on the subject:

http://www.landfield.com/faqs/unix-faq/shell/csh-whynot/



More information about the NCLUG mailing list