Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14193
| From | PePa <solusos@passchier.net> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Conditions with logical operators and nested groups execute "if" and "else" |
| Date | 2018-05-31 20:05 +0700 |
| Message-ID | <mailman.873.1527781619.1292.bug-bash@gnu.org> (permalink) |
| References | <5B0F3BB2.1000006@tlinx.org> <CAM4RgKgOACdJtjBFpKMhfoXvbSwun=84pPdADNaJVKcd-Z5GFg@mail.gmail.com> <20180522122911.pgnaedyb55uhxugw@eeg.ccf.org> <1795.1527749654@jinx.noi.kre.to> |
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
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Conditions with logical operators and nested groups execute "if" and "else" PePa <solusos@passchier.net> - 2018-05-31 20:05 +0700
csiph-web