Subject: Re: /bin/sh and case and (*^*)
To: None <tech-userlevel@netbsd.org>
From: Roland Illig <rillig@NetBSD.org>
List: tech-userlevel
Date: 04/29/2006 10:43:09
Bruce Korb wrote:
>> I haven't seen a case pattern start with a open parenthesis before. Is 
>> this okay?

According to the "Shell Command Language" of POSIX, it's ok.

>> If so, should /bin/sh support it?

Yes, I think our /bin/sh should comply to POSIX.

> It would be interesting to know if there are special circumstances
> where balanced parentheses fail and just the close parethesis works.

The NetBSD 3.0 /bin/sh says:

$ case $foo in (bar) echo "it's bar";; esac
Syntax error: word unexpected (expecting ")")

The Solaris 5.8 /bin/sh says:

$ case $foo in (bar) echo "it's bar";; esac
syntax error: `(' unexpected

(Well, after all we know about Solaris' /bin/sh, it's no wonder they 
don't support it. But NetBSD's /bin/sh should really do.)

Roland