Strange if statement behaviour when using bash/bash script
Hi,
I have a strange behaviour I don't seem to understand. Bash version is: Code:
$ bash --version Code:
]$ echo $? Code:
echo $? Code:
$./do Code:
echo $? Code:
1 Thanks, Indy |
Code:
# ls no_such_file |
Code:
line 0: some_failed_command |
I think you want $* not $?
|
oh yeah that's right.
But still, it doesn't change if i change the code to: Code:
retval=$? Code:
1 |
Code:
if [ $retval -ne 1 ] ; then |
oh my, would you believe it.
Thanks colucix. Ofcourse it must be bummer. I guess i was too tired to think. Indy |
I copied your first script, and it was working as expected by you. I wonder if you posted the complete script or only this fragment.
Anyway, in cases like this run your script with: Code:
sh -x yourscript.sh jlinkels |
All times are GMT -5. The time now is 08:51 AM. |