mercredi 17 avril 2019

SHELL - AND operation within IF statement

Assuming thoses functions :

return_0() {
   return 0
}

return_1() {
   return 1
}

Then the following code :

if return_0; then
   echo "we're in" # this will be displayed
fi

if return_1; then
   echo "we aren't" # this won't be displayed
fi

if return_0 -a return_1; then
   echo "and here we're in again" # will be displayed - Why ?
fi

Why I am getting into the last ifstatement ? Aren't we supposed to be out of the condition with those 0 and 1 ?

Aucun commentaire:

Enregistrer un commentaire