Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15176

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

From Andreas Schwab <schwab@suse.de>
Newsgroups gnu.bash.bug
Subject Re: Combination of "eval set -- ..." and $() command substitution is slow
Date 2019-07-16 11:32 +0200
Message-ID <mailman.1493.1563269552.2688.bug-bash@gnu.org> (permalink)
References <bcd08f6c-1c13-0eb4-92b2-4e904b19a0ce@e-nautia.com> <8091.1563212947@jinx.noi.kre.to> <08d234bc-5dca-38f5-cb38-02b0c7fee542@iki.fi> <mvmy30y8guu.fsf@suse.de>

Show all headers | View raw


On Jul 16 2019, Ilkka Virta <itvirta@iki.fi> 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, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Combination of "eval set -- ..." and $() command substitution is slow Andreas Schwab <schwab@suse.de> - 2019-07-16 11:32 +0200

csiph-web