What does || :
mean in the context of a shell script?
I just came across this line:
eval "/usr/bin/mybinary aparameter" || :
bash
What does || :
mean in the context of a shell script?
I just came across this line:
eval "/usr/bin/mybinary aparameter" || :
Best Answer
The
||
is an “or” comparison operator.The
:
is a null operator which does… Nothing. Well, it does return a successful exit status… If you need that?So in your case:
The pseudo-example either
eval
s as true or do… Nothing… But return a successful exit status. It seems silly but it’s all pseudo-code to show you general structure so it does seem to make sense in a way.