Numeric test when using the conditional operator
Posted
by lupuslupus
on Stack Overflow
See other posts from Stack Overflow
or by lupuslupus
Published on 2010-06-03T05:19:12Z
Indexed on
2010/06/03
5:24 UTC
Read the original article
Hit count: 160
bash
In bash, why doesn't this work:
$ echo $((1 -gt 2 ? 3 : 4))
bash: 1 -gt 2 ? 3 : 4: syntax error in expression (error token is "2 ? 3 : 4")
Neither does this:
$ echo $(((1 -gt 2) ? 3 : 4))
bash: (1 -gt 2) ? 3 : 4: missing `)' (error token is "2) ? 3 : 4")
© Stack Overflow or respective owner