Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Andreas Schwab Newsgroups: gnu.bash.bug Subject: Re: Combination of "eval set -- ..." and $() command substitution is slow Date: Tue, 16 Jul 2019 11:32:25 +0200 Lines: 34 Approved: bug-bash@gnu.org Message-ID: References: <8091.1563212947@jinx.noi.kre.to> <08d234bc-5dca-38f5-cb38-02b0c7fee542@iki.fi> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: usenet.stanford.edu 1563269552 25063 209.51.188.17 (16 Jul 2019 09:32:32 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Robert Elz , bug-bash@gnu.org To: Ilkka Virta Envelope-to: bug-bash@gnu.org X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Yow: I want another RE-WRITE on my CAESAR SALAD!! In-Reply-To: <08d234bc-5dca-38f5-cb38-02b0c7fee542@iki.fi> (Ilkka Virta's message of "Tue, 16 Jul 2019 12:18:45 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <8091.1563212947@jinx.noi.kre.to> <08d234bc-5dca-38f5-cb38-02b0c7fee542@iki.fi> Xref: csiph.com gnu.bash.bug:15176 On Jul 16 2019, Ilkka Virta 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."