Shell - || - OR Boolean operator

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

Table of Contents

1 - About

OR lists are sequences of one or more pipelines separated by the boolean operator ||.

An OR list has the form

command1 || command2

command2 is executed if, and only if, command1 returns a non-zero exit status (false). It means that OR lists are executed with left associativity.

The return status of and and or lists is the exit status of the last command executed in the list.

Advertising