On 09/11/2012 08:50 AM, Benoit Vaugon wrote:

> Bash Version: 4.1
> Patch Level: 7

> Repeat-By:
>   echo $(for x in whatever; do case y in *) echo 42;; esac; done)

The syntax error is still present in bash 4.2 patchlevel 37:

$  echo $(for x in whatever; do case y in *) echo 42;; esac; done)
bash: syntax error near unexpected token `;;'
$ bash --version | head -n1
GNU bash, version 4.2.37(1)-release (x86_64-redhat-linux-gnu)

and also present in very recent ksh and zsh:

# ksh -c 'echo $(for x in whatever; do case y in *) echo 42;; esac; done) '
ksh: syntax error at line 1: `;;' unexpected

but not in mksh or dash:

# dash -c 'echo $(for x in whatever; do case y in *) echo 42;; esac; done) '
42

Looks like you found a real bug, but a tough one to fix if even ksh gets
it wrong.

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to