Operators
Logical Operators
# Logical Operators:
==            # Test for exact equality
-lt           # Less than
-ge           # Greater than or equal to.
-ne [or] !=   # Not equal to.
-z $string    # Checks if $string is a null string.Boolean Operators
# Boolean Operators:
||    # OR
&&    # ANDCommand 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.
command1 || command2    # Command error handlingFrom Groq:
Here,
command1is the command that is executed first. Ifcommand1fails (i.e., returns a non-zero exit status), thencommand2is executed. Ifcommand1succeeds (i.e., returns a zero exit status), thencommand2is not executed.
Last updated
