fetchmail-friends
[Top] [All Lists]

[fetchmail]Re: if spoils $? (was: Solution: MDA returned nonzero status 65)

2005-04-27 14:14:44
if [ $? == 65 ] ; then
  exit 0
fi
exit $?

This is bogus. 1. POSIX shells don't have ==, use = instead.
2. The if [ ... spoils $?.

Matthias,

Are you sure about your #2? I use $? all the time in "if" constructs and
it works for me. The following script (using sh on Solaris and bash on
Linux) does not behave as though $? is being "spoiled".

#!/bin/sh
#
false
if [ $? -eq 0 ]; then
   echo "Should not get this."
   fi
#
true
if [ $? -eq 0 ]; then
   echo "Should get this."
   fi


Can you point me to somewhere where it refers to spoilage in such
instances?

Steve



<Prev in Thread] Current Thread [Next in Thread>