Subject: Re: bin/8893: possible parsing bug in test?
To: None <>
From: Todd Whitesel <>
List: netbsd-bugs
Date: 12/03/1999 01:26:02
> 	If the above breakage is correct, then just about every shell script
> 	that uses -o or -a with arbitrary string comparison is going to need
> 	to do something like:
> 	[ "X$x" = XHELP -o "X$x" = XBOB ] && echo bob
> 	which is ugly, but if true needs to be documented in the manpage

I've been doing this in my scripts for many years, because many versions
of test (or a shell built-in) aren't smart enough to successfully decode
all the variant cases and do the right thing in all of them.

I remember reading somewhere that there was a basic parsing ambiguity in
the syntax of test(1), and so it would never be possible to totally fix
this problem. Since there are already plenty of existing broken binaries
out there, it is just better to code defensively.

I agree that the man page should have a note added in the BUGS section,
and perhaps in the main text, pointing out this subtlely of the syntax.

Todd Whitesel
toddpw @