difference between the -o and || conditionals.

From: Dexter (dexter_at_rec-all.com)
Date: 12/01/04


Date: 1 Dec 2004 08:42:02 -0800

Hi All,

Can someone please tell me the difference between the following constructs.

if [ $? -ne 0 ] -o [ "`cat $tmp_file | grep -i error`" ] ; then
print "error"
fi

                              ==OR===

if [ $? -ne 0 ] || [ "`cat $tmp_file | grep -i error`" ] ; then
print "error"
fi
                              ==OR===

if [ $? -ne 0 -o "`cat $tmp_file | grep -i error`" ] ; then
print "error"
fi

Thanks,
Dexter.