[fetchmail]Re: if spoils $? (was: Solution: MDA returned nonzero status 65)
Steve Sheftic
kern0201@siscom.net
Tue, 26 Apr 2005 22:20:39 -0400 (EDT)
> > 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