I found this piece of code in a .sh script:
(test -x "$1" || which "$1")
What does this operator ||
mean?
it means:
if the first command succeed the second will never be executed
It's equivalent to boolean "or" with short-circuiting evaluation, such that it will execute the second command only if the first returns some value corresponding to "false". For example:
false || echo "foo"
echoes "foo", while
true || echo "foo"
Prints nothing. The &&
operator provides a complimentary operation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With