In bash what does the syntax ||:
do?
Example
$ ls foo ||:
Other than always return success, does this do anything else special?
Is the output of $ ls foo ||:; echo $?
always zero, even if ls foo
fails because foo
doesn't exist?
I saw it in a script that begins with set -e
. So I'm guessing it ensures that no error occurs, thus the script does not immediately exit, even if a command suffixed by this returns an error.