bug-bash
[Top][All Lists]
Advanced

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

`()' subshell parsing fails in `case' clause


From: hcz
Subject: `()' subshell parsing fails in `case' clause
Date: Tue, 03 Jan 2006 13:43:48 +0100

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2
uname output: Linux tazzelwurm 2.6.14hcz1d #6 PREEMPT Thu Dec 8 11:56:38 CET 
2005 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 3.1
Patch Level: 0
Release Status: release

Description: 
        The closing bracket in a case clause within a () subshell
        gets interpreted as the subshell's closing bracket.

Repeat-By:
#!/bin/bash
x=$(
    case $(ls) in
        example) failsHere;;
    esac
)

results in:
/bashbug.sh: line 4: syntax error near unexpected token `;;'
./bashbug.sh: line 4: `        example) failsHere;;'


Fix:
        move the offending code out into a function and call the
        function from the subshell.




reply via email to

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