bug-bash
[Top][All Lists]
Advanced

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

Re: case statement breaks $( ) substitution


From: Stephane Chazelas
Subject: Re: case statement breaks $( ) substitution
Date: Fri, 6 Oct 2006 11:33:25 +0100
User-agent: mutt-ng/devel-r562 (Linux)

On Fri, Oct 06, 2006 at 11:55:27AM +0200, hcz@hczim.de wrote:
[...]
> Repeat-By:
> 
>         $ echo $(
>         >   case a in
>         >     1) :;;
>         bash: syntax error near unexpected token `;;'
> 
>         The closing `)' is misinterpreted as being the end of the `$('
>         substitution, instead of being recognized as element of the
>         case block which it is part of.
[...]

It's a known limitation also in zsh and some versions of ksh.

Use

$(
  case a in
    (1) ;;
  esac
)

instead.

-- 
Stephane




reply via email to

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