On Mon, Sep 05, 2022 at 11:04:41PM -0400, Dale R. Worley wrote: > Julian Gilbey <j...@debian.org> writes: > > Upgrading to bash 5.2.0(1)-rc2 did not help, neither did using \( > > instead of (, and neither did putting spaces around the parentheses. > > It's ugly. The first point is that ( and ) are special characters and > if unquoted are isolated tokens that have special syntax. So in order > to get [ to see them as arguments, you have to quote ( and ). But the > quoted characters are ordinary characters and to make them be separate > arguments to [, you have to separate them from the adjacent arguments > with spaces. So this version works: > > if [ \( "$1" = "yes" -o "$1" = "YES" \) -a \( "$2" = "red" -o "$2" = > "RED" \) ] > then > echo "Yes, it's red" > else > echo "No, it's not red" > fi > > Dale
Thanks Dale! I agree that it's ugly :) Best wishes, Julian