Hi,
I have a strange behaviour I don't seem to understand.
Bash version is:
Code:
$ bash --version
GNU bash, version 3.00.15(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.
In my prompt i do the following:
Code:
]$ echo $?
1
$ if [ $? -eq 1 ] ; then
> echo good
> else
> echo bummer
> fi
good
So far so good. Logic seem right, BUT in my script whre I have exactly the same code:
Code:
echo $?
if [ $? -eq 1 ] ; then
echo good
else
echo bummer
fi
I get:
If I change the logic in my script (Completely the opposite):
Code:
echo $?
if [ $? -ne 1 ] ; then
echo good
else
echo bummer
fi
I get:
Now, for me this is very odd. Am I missing something?
Thanks,
Indy