[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how does bash parse back-ticks, anyway?
From: |
Sven Mascheck |
Subject: |
Re: how does bash parse back-ticks, anyway? |
Date: |
Fri, 20 Apr 2007 00:52:45 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Eric Blake wrote:
> Read the POSIX rationale:
> http://www.opengroup.org/onlinepubs/009695399/xrat/xcu_chap02.html
> | [...] While the newer "$()" form can process
> | any kind of valid embedded script, the backquoted form cannot handle
> | some valid scripts that include backquotes. For example, these
> otherwise
> | valid embedded scripts do not work in the left column, but do work
> on
> | the right:
> |
> | echo ` echo $(
> | cat <<\eof cat <<\eof
> | a here-doc with ` a here-doc with )
> | eof eof
> | ` )
> |
> | echo ` echo $(
> | echo abc # a comment with ` echo abc # a comment with )
> | ` )
BTW,
My bash-3.2.15(1)/libc2.3.6/i686-pc-linux-gnu-2.6.13 (like previous
releases) fails on the first $() example. It also fails if the
here-doc contains a single, double or back quote instead of the ).
"case x in x)" in $() is also not accepted; this is to be worked
around with "case x in (x)" (POSIX is stricter, though).
Academic failure: an embedded here-doc, with unproblematic content,
but ) as delimiter instead of eof.
[ksh93 and all almquist shells are robust about all these.
zsh and pdksh behave very similar to bash.]
[[The second $() example from above was fixed with bash-3.2]]
- Re: how does bash parse back-ticks, anyway?,
Sven Mascheck <=