Subject: bin/32523: sh(1): case does not support optional leading parenthesis
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Thomas Klausner <wiz@NetBSD.org>
List: netbsd-bugs
Date: 01/14/2006 19:50:00
>Number:         32523
>Category:       bin
>Synopsis:       sh(1): case does not support optional leading parenthesis
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 14 19:50:00 +0000 2006
>Originator:     Thomas Klausner
>Release:        NetBSD 3.99.15
>Organization:
>Environment:
	
	
Architecture: i386
Machine: i386
>Description:
/bin/sh does not parse the case construct according to SUSv3.
XCU describes it as:
 case word in
     [(]pattern1)                 compound-list;;
     [(]pattern2|pattern3)        compound-list;;
     ...
 esac

when sh(1) meets a leading parenthesis, it errors out with
Syntax error: word unexpected (expecting ")")

ksh(1) handles it correctly.
>How-To-Repeat:
Run the following shell script:

#!/bin/sh
case foo in
	(foo|bar)
		echo found;;
	*)
		echo not found;;
esac

>Fix:
Not provided.

>Unformatted: