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


Groups > gnu.bash.bug > #15176 > unrolled thread

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

Started byAndreas Schwab <schwab@suse.de>
First post2019-07-16 11:32 +0200
Last post2019-07-16 11:32 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromAndreas Schwab <schwab@suse.de>
Date2019-07-16 11:32 +0200
SubjectRe: Combination of "eval set -- ..." and $() command substitution is slow
Message-ID<mailman.1493.1563269552.2688.bug-bash@gnu.org>
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."

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web