On Mon, Sep 05, 2022 at 06:05:04PM -0400, Greg Wooledge wrote: > On Mon, Sep 05, 2022 at 09:55:29PM +0100, Julian Gilbey wrote: > > if [ ("$1" = "yes" -o "$1" = "YES") -a ("$2" = "red" -o "$2" = "RED") ] > > You're doing it wrong. The parentheses have to be quoted, and separate. > > [ "(" "$1" = yes" -o "$1" = YES" ")" -a ... ] > > I'd strongly recommend that you DON'T do this, for two reasons: > > 1) It's not compatible with the POSIX [ command. > > 2) Bash offers the [[ command instead, which is a lot more powerful. > With [[ you can do it this way: > > [[ ( $1 = yes || $1 = YES ) && ... ]]
Oh, nice! Thanks, Julian