« echo '"\$z' » — differences between dash and bash in POSIX mode irrespective of xpg_echo

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

 



Hello,

I download https://ftp.gnu.org/gnu/gdb/gdb-15.2.tar.xz and run there ./configure . configure has on line 19728

   echo 'cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&' &&
  
(also at https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=configure#l19730 ).  It produces the file config.status .

When I use the most recent dash (commit 60eeccd0324a904a5f, ./configure && make install, /bin/sh is that dash) config.status has on line 708

  cat >>"/subs1.awk" <<\_ACAWK &&

But if /bin/sh is instead bash 4.4.12, line 708 in config.status is

  cat >>"$ac_tmp/subs1.awk" <<\_ACAWK &&

Why does it differ?

I have written at https://lore.kernel.org/dash/15ef5aaa-8766-48f7-9f3d-6b11838a0b95@xxxxxxxxxxx/ on a similar topic and my reading of the answer is to use print instead of echo, and that the output of the snippet below can be modified by calling shopt -s xpg_echo or shopt -u xpg_echo, before the execution, or during the execution (by including  shopt -s/-u xpg_echo  on the second line):

  #!/bin/sh
  echo '"\$z'

But it does not change, bash always puts \  before $, while dash does not include the slash.

See also https://sourceware.org/bugzilla/show_bug.cgi?id=32252 .

Greetings
  Дилян







[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux