1 # inconsistency with quoted pattern substitution patterns through bash-4.2
2 # fixed in a ksh93-compatible (and Posix-compatible, in general) way
3 # NOT backwards compatible
7 # why does this work, this list was born of frustration, I tried
8 # everything I could think of.
9 echo \'${test//"'"/\'\\\'\'}\'" "
11 #but none of the following
13 echo "'${test//"'"/}'"
15 echo "'${test//"'"/"'\\''"}'"
17 echo "'${test//"'"/\'\\'\'}'"
19 #echo "'${test//'/}'" # hangs waiting for '
20 #echo "'${test//"'"/'\\''}'" # hangs waiting for '
24 echo "${test//str/"dd dd"}"
25 echo ${test//str/"dd '\''dd"}
30 echo "${test//str/"dddd"}"
32 echo ${test//str/"dddd"}
36 echo "${test//str/"'"}"
38 #echo "${test//str/'}" # hangs
41 echo "${test//"'"/"'"}"
43 x="a'b'c"; echo "${x//\'/\'}"
45 printf '%s\n' "foo ${IFS+"b c"} baz"
47 # this is where the default behavior differs from posix
49 echo "foo ${IFS+'bar} baz"