Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: parenthesis inside $(...)



Stephane Chazelas wrote:
> $ zsh << \E
> heredoc> echo $(
> heredoc>    case x in  x) echo x;; esac
> heredoc> )
> heredoc> E
> zsh: parse error near `;;'
> zsh: parse error near `)'

Yes, it's known about (it's hinted at in the tip on page 314 of From
Bash to Z Shell: Conquering the Command Line, by Oliver Kiddle, Jerry
Peek and Peter Stephenson, Apress, ISBN 1 59059 376 6, in case anyone
hasn't got around to buying that yet) and the general feeling when this
came up here before was that it was pretty much inevitable.

The right way of constructing a nested case is with balanced
parentheses:

echo $(
   case x in (x) echo x;; esac
)

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



Messages sorted by: Reverse Date, Date, Thread, Author