On Mon, Jul 11, 2022 at 8:22 AM Chet Ramey <chet.ra...@case.edu> wrote:
> The normal rules of precedence apply, and the conditional expression on the > rhs of the `:' can't contain an assignment, since the assignment operator > has higher precedence. > > This excerpt from the Bash man page ARITHMETIC EVALUATION section: expr?expr:expr conditional operator = *= /= %= += -= <<= >>= &= ^= |= assignment indicates that assignment has a lower precedence than the overall ternary without specifying precedence of individual parts of it. Interestingly, zsh requires both assignments to be parenthesized and ksh doesn't require either. Bash is like C and ksh is like cpp.