On 05/31/2018 01:54 PM, Robert Elz wrote:
> I am not sure what predence rule you see working as
> expected, but in sh (bash, or any other Bourne syntax
> or POSIX shell) there is no precedence for && and ||
> they (in the absense of grouping) are simply executed
> left to right as written.

Here is an easy way to figure out how and/or-lists work: Given that &&
and || have the lowest precedence of all operators (except for ; and &),
they can be thought of as concatenating commands/blocks/pipelines, and
the execution rule for an and/or-list is:

If the exit-status of the command/block/pipeline is 0, continue after
the next &&, otherwise continue after the next || in the and/or-list.

Cheers,
Peter

Reply via email to