[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash-4.0 regression with comments in subshelled case
From: |
Chet Ramey |
Subject: |
Re: bash-4.0 regression with comments in subshelled case |
Date: |
Tue, 03 Mar 2009 15:28:28 -0500 |
User-agent: |
Thunderbird 2.0.0.19 (Macintosh/20081209) |
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.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/