bug-bash
[Top][All Lists]
Advanced

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

Re: Should nested case statements within command substitutions work on i


From: Chris F.A. Johnson
Subject: Re: Should nested case statements within command substitutions work on in bash 3.2.x?
Date: Sun, 22 Mar 2015 01:49:15 -0400 (EDT)
User-agent: Alpine 2.10 (DEB 1266 2009-07-14)

On Sun, 22 Mar 2015, Jon Seymour wrote:

I was surprised that this didn't work with the OSX version of bash 3.2:

    /bin/bash -c 'echo $(case "yes" in yes) echo yes; ;; no) echo no; ;; esac)'

/bin/bash: -c: line 0: syntax error near unexpected token `;;'
/bin/bash: -c: line 0: `echo $(case "yes" in yes) echo yes; ;; no)
echo no; ;; esac)'

It does work with bash 4.x.

Is this a known issue with 3.2 or is it particular to the OSX
implementation (which in my case is 3.2.53(1))?

  Balance the parentheses:

echo $(case "yes" in (yes) echo yes; ;; (no) echo no; ;; esac)

--
Chris F.A. Johnson, <http://cfajohnson.com>



reply via email to

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