What is the `||` operator?

0107

The || operator is a logical OR operator. In a conditional command sequence, it allows you to execute the command that follows it only if the command before it fails (i.e., returns a non-zero exit status).

For example:

command1 || command2

In this case, command2 will run only if command1 fails. If command1 completes successfully (returns an exit status of 0), command2 will not be executed.

0 Comments

no data
Be the first to share your comment!