From: pub...@yeti.selfip.net To: bug-bash@gnu.org Configuration Information [Automatically generated, do not change]: FALSE!!! Machine: i586 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-mandriv a-linux-gnu' -DCONF_VENDOR='mandriva' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I.. -I../include -I../lib -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffe r-size=4 -fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables uname output: Linux sp-ausy6.spna 2.6.27.37-desktop-1mnb #1 SMP Tue Oct 13 13:33:31 EDT 2009 i686 Intel(R) Core(TM)2 CPU T5500 @ 1.66GHz GNU/Linux Machine Type: i586-mandriva-linux-gnu
Bash Version: 3.2 Patch Level: 19 Release Status: release The above generated output is FALSE, as proven by: [y...@localhost ~]$ ls -l /proc/$$/ | grep exe lrwxrwxrwx 1 yves yves 0 2010-06-23 10:30 exe -> /opt/bash-4.1/bin/bash* This is a self-compiled latest version (4.1) configured this way: ./configure --prefix=/opt/bash-4.1 --enable-alias \ --enable-arith-for-command --enable-array-variables \ --enable-bang-history --enable-brace-expansion \ --enable-casemod-attributes --enable-casemod-expansions \ --enable-command-timing --enable-cond-command \ --enable-cond-regexp --enable-coprocesses \ --enable-directory-stack --enable-dparen-arithmetic \ --enable-extended-glob --enable-history --enable-job-control \ --enable-multibyte --enable-net-redirections \ --enable-process-substitution --enable-progcomp \ --enable-prompt-string-decoding --enable-readline \ --enable-select --with-installed-readline (installed readline was not used however, as it is too old) and run this way while in the legacy bash-3.2 in gnome-terminal: exec /opt/bash-4.1/bin/bash Description: I want to generate a "bash-proof" string by enclosing it in single quotes and managing enclosed single quotes. Basically, I would replace << word1 word'2 >> with << 'word1 word'"'"'2' >>. I can't find the syntax for doing this with the ${p//x/y} substitution (see example below). Actually, command #4 /does/ produce the right substitution, but as soon as I enclose it in double quotes, extra double-quotes appear, and I can't see the logic behind it, nor the logic behind my further tests' results. Repeat-By: [y...@localhost 1]$ test="word1 word'2" [y...@localhost 2]$ echo "$test" word1 word'2 [y...@localhost 3]$ echo ${test//'/'"'"'} > ^C [y...@localhost 4]$ echo ${test//"'"/"'\"'\"'"} word1 word'"'"'2 [y...@localhost 5]$ echo "${test//"'"/"'\"'\"'"}" word1 word"'"'"'"2 [y...@localhost 6]$ echo "${test//"'"/'\"'\"'}" > ^C [y...@localhost 7]$ echo "${test//"'"/\'\"\'\"\'}" word1 word\'"\'"\'2