bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash-4.0 regression with comments in subshelled case


From: Mike Frysinger
Subject: Re: bash-4.0 regression with comments in subshelled case
Date: Tue, 3 Mar 2009 17:52:47 -0500
User-agent: KMail/1.11.0 (Linux/2.6.28; KDE/4.2.0; x86_64; ; )

On Tuesday 03 March 2009 17:14:16 Chet Ramey wrote:
> Mike Frysinger wrote:
> > On Tuesday 03 March 2009 15:28:28 Chet Ramey wrote:
> >> Mike Frysinger wrote:
> >>> code that uses case statements in a subshell and then uses comments
> >>> causes bash to trigger a parsing error:
> >>> $ cat test.sh
> >>> echo $(case a in (a) echo ok ;; # comment
> >>> )
> >>> $ sh ./test.sh
> >>> ./test.sh: line 1: unexpected EOF while looking for matching `)'
> >>> ./test.sh: line 3: syntax error: unexpected end of file
> >>
> >> As well it should.  Bash parses the contents of command substitutions,
> >> so it will look forever for the missing `esac'.  The error message could
> >> be improved.
> >
> > sorry, the test case in the e-mail had a typo and didnt match the test
> > case i was actually using.  the 2nd line should clearly be "esac)"
>
> In that case, try the attached patch.

thanks, that fixes it

> And note that you don't have to
> use extra left parens around the pattern lists.

with bash-4, sure.  but this code needs to be compatible with bash-3 for a 
while and that means working around the old bug of subshelled case statements 
not parsing correctly.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]