bug-bash
[Top][All Lists]
Advanced

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

Re: Combination of "eval set -- ..." and $() command substitution is slo


From: Andreas Schwab
Subject: Re: Combination of "eval set -- ..." and $() command substitution is slow
Date: Tue, 16 Jul 2019 11:32:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)

On Jul 16 2019, Ilkka Virta <address@hidden> wrote:

> On 15.7. 20:49, Robert Elz wrote:
>
>>                      printf '%s\n' "`printf %s "$i"`"
>>                      printf '%s\n' "$(printf %s "$i")"
>>
>> aren't actually the same.   In the first $i is unquoted, in the second it is
>> quoted.   
>
> Huh, really? It looks to me like the first one treats $i as quoted too:
>
>  $ touch file.txt; i='123 *'
>  $ printf '%s\n' "`printf :%s: "$i"`"
>  :123 *:

It is not portable, see the autoconf manual:

    ... is not portable, since not all shells properly understand
    `"`..."..."...`"', for example Solaris 10 ksh:

         $ foo="`echo " bar" | sed 's, ,,'`"
         ksh: : cannot execute
         ksh: bar | sed 's, ,,': cannot execute

    Posix does not specify behavior for this sequence.

Andreas.

-- 
Andreas Schwab, SUSE Labs, address@hidden
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



reply via email to

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