I was skimming through an /etc/rc.d/init.d/sendmail
file (I know this is hardly ever used, but I'm studying for an exam), and I've become a bit confused about the &&
and the ||
operators. I've read where they can be used in statements such as:
if [ test1 ] && [ test2 ]; then
echo "both tests are true"
elif [ test1 ] || [ test2 ]; then
echo "one test is true"
fi
However, this script shows single line statements such as:
[ -z "$SMQUEUE" ] && SMQUEUE="QUEUE"
[ -f /usr/sbin/sendmail ] || exit 0
These seem to be using the &&
and ||
operators to elicit responses based on tests, but I haven't been able to dig up documenation regarding this particular use of these operators. Can anyone explain what these do in this particular context?