zsh-workers
 help / color / mirror / code / Atom feed
* parenthesis inside $(...)
@ 2006-02-07 19:53 Stephane Chazelas
  2006-02-07 20:15 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2006-02-07 19:53 UTC (permalink / raw)
  To: Zsh hackers list

Hi,

Would that:

http://groups.google.com/group/comp.unix.shell/msg/18e47b386da472bd

be an already known issue.

Essentially:

$ zsh << \E
heredoc> echo $(
heredoc>    case x in  x) echo x;; esac
heredoc> )
heredoc>
heredoc> echo $(
heredoc>    echo comment # with )
heredoc> )
heredoc>
heredoc> echo $(
heredoc> cat <<\eof
heredoc>       here-doc with )
heredoc> eof
heredoc> )
heredoc>
heredoc> echo $(
heredoc> cat <<\eof
heredoc>    '   # or a single back- or doublequote
heredoc> eof
heredoc> )
heredoc> E
zsh: parse error near `;;'
zsh: parse error near `)'
comment
zsh: parse error near `)'
here-doc with
zsh: command not found: eof
zsh: parse error near `)'
zsh: parse error near `$('

Best regards,
Stéphane


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: parenthesis inside $(...)
  2006-02-07 19:53 parenthesis inside $(...) Stephane Chazelas
@ 2006-02-07 20:15 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2006-02-07 20:15 UTC (permalink / raw)
  To: Zsh hackers list

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@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-07 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-07 19:53 parenthesis inside $(...) Stephane Chazelas
2006-02-07 20:15 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).