On Mon, Jun 6, 2016 at 2:21 PM, Eric Blake <ebl...@redhat.com> wrote:
> On 06/06/2016 07:31 AM, Zack Weinberg wrote:
>
>> VAR2="`AS_ECHO("$VAR") | sed 's/text1//g'`"
>
> Correct in a POSIX shell, but liable to misbehave on some older shells.
> Better is:
>
> VAR2=`AS_ECHO("$VAR") | sed 's/text1//g'`
>
> Since it is in assignment context, you don't need the outer "" to
> prevent word splitting, the `` is enough for the shell to know where the
> assignment ends.

I am under the impression that there did once exist shells for which
the outer quotes *were* necessary to prevent word splitting (and
therefore misinterpretation of the overall statement as a
single-command environment variable override).  I am also under the
impression that any shell new enough to implement $() will *not* do
word splitting in a variable assignment.

Both of these factoids come out of the same "bitter experience with
vendor /bin/sh circa 1996" box in my head, so they may be totally
wrong, or they may only apply to shells sufficiently ancient as to be
irrelevant nowadays -- does anyone know for sure?

zw

_______________________________________________
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to