What does ||: mean in the shell?
2 answers
||
is boolean or.
:
is a no-op command that does nothing and exits with a truthful status.
So, anything || :
unconditionally returns true.
So some_command_that_may_fail ||:
it will always be successful.
This is important if there is an set -e
ERR or trap in use but you don't want your script to exit or throw an error if the command fails.
+7
source to share