Operators
Logical Operators
Boolean Operators
Command Operators
The
||
command operator in Bash is called the "logical OR" operator. It is used to execute a command only if the preceding command fails or returns a non-zero exit status.
From Groq:
Here,
command1
is the command that is executed first. Ifcommand1
fails (i.e., returns a non-zero exit status), thencommand2
is executed. Ifcommand1
succeeds (i.e., returns a zero exit status), thencommand2
is not executed.
Last updated