I have come across some strange behavious (well probably not strange but I don't understand it !)
I want to write some if / e,se statements using the bash shorthand syntax:
[[ 1 -eq 1 ]] && echo "true" || echo "false"
The output of the above code gives:
true
Now the code above actually works fine. But this next code does not:
[[ 1 -eq 1 ]] && infMsg "true" || infMsg "false"
infMsg is just a function. The output from the above code gives:
true
false
I only want it to say 'true'.
Is there something I am missing in the way the && || syntax handles exit codes from functions ?