if – in what situations does this work?
First of all I suppose you're using the bash.
Amoung others the shell treats several parameters specially; these
parameters may only be referenced and assignement to them is not
allowed.
One of them is $?, which expands to the exit status of the most
recently executed command. However, the exit status 0 means that the
command has been executed without errors; any other return value has to
be interpreted as error code.
e.g.
# any command ...
if [ $? -ne 0 ]; then
# error handling
fi
/franzR
On Sat, 18 Feb 2012 13:56:50 +0100, Johnny Rosenberg wrote:
I tried this with the $? variable, but failed. Seems like [[ $? ]] is
always true no matter the value of $?. [[ $? == 0 ]] seems to work,
though.
I thought that ”if [[ $? ]]” means ”if $? is True”. What is True
anyway? 0? 1? Anything but 0?
I am not sure what I am asking for here, but any kind of input in the
subject is welcome. Thanks.
Kind regards
Johnny Rosenberg
ジョニー・*ーゼンバーグ
/*
************************************************** **********
* Mail checked by Avira virus scanner (mail.htl-wels.at).
************************************************** **********
*/
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
|