]>
Commit | Line | Data |
---|---|---|
8868edaf CR |
1 | # This program is free software: you can redistribute it and/or modify |
2 | # it under the terms of the GNU General Public License as published by | |
3 | # the Free Software Foundation, either version 3 of the License, or | |
4 | # (at your option) any later version. | |
5 | # | |
6 | # This program is distributed in the hope that it will be useful, | |
7 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | # GNU General Public License for more details. | |
10 | # | |
11 | # You should have received a copy of the GNU General Public License | |
12 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
13 | # | |
495aee44 CR |
14 | # From mksh |
15 | ||
d233b485 | 16 | set -o posix ; shopt -u xpg_echo |
495aee44 CR |
17 | |
18 | (echo 1 ${IFS+'}'z}) 2>&- || echo failed in 1 | |
19 | (echo 2 "${IFS+'}'z}") 2>&- || echo failed in 2 | |
20 | (echo 3 "foo ${IFS+'bar} baz") 2>&- || echo failed in 3 | |
21 | (echo -n '4 '; printf '%s\n' "foo ${IFS+"b c"} baz") 2>&- || echo failed in 4 | |
22 | (echo -n '5 '; printf '%s\n' "foo ${IFS+b c} baz") 2>&- || echo failed in 5 | |
23 | (echo 6 ${IFS+"}"z}) 2>&- || echo failed in 6 | |
24 | (echo 7 "${IFS+"}"z}") 2>&- || echo failed in 7 | |
25 | (echo 8 "${IFS+\"}\"z}") 2>&- || echo failed in 8 | |
26 | (echo 9 "${IFS+\"\}\"z}") 2>&- || echo failed in 9 | |
27 | (echo 10 foo ${IFS+'bar} baz'}) 2>&- || echo failed in 10 | |
28 | (echo 11 "$(echo "${IFS+'}'z}")") 2>&- || echo failed in 11 | |
29 | (echo 12 "$(echo ${IFS+'}'z})") 2>&- || echo failed in 12 | |
30 | (echo 13 ${IFS+\}z}) 2>&- || echo failed in 13 | |
31 | (echo 14 "${IFS+\}z}") 2>&- || echo failed in 14 | |
32 | u=x; (echo -n '15 '; printf '<%s> ' "foo ${IFS+a"b$u{ {"{{\}b} c ${IFS+d{}} bar" ${IFS-e{}} baz; echo .) 2>&- || echo failed in 15 | |
33 | l=t; (echo 16 ${IFS+h`echo -n i ${IFS+$l}h`ere}) 2>&- || echo failed in 16 | |
34 | l=t; (echo 17 ${IFS+h$(echo -n i ${IFS+$l}h)ere}) 2>&- || echo failed in 17 | |
35 | l=t; (echo 18 "${IFS+h`echo -n i ${IFS+$l}h`ere}") 2>&- || echo failed in 18 | |
36 | l=t; (echo 19 "${IFS+h$(echo -n i ${IFS+$l}h)ere}") 2>&- || echo failed in 19 | |
37 | l=t; (echo 20 ${IFS+h`echo -n i "${IFS+$l}"h`ere}) 2>&- || echo failed in 20 | |
38 | l=t; (echo 21 ${IFS+h$(echo -n i "${IFS+$l}"h)ere}) 2>&- || echo failed in 21 | |
39 | l=t; (echo 22 "${IFS+h`echo -n i "${IFS+$l}"h`ere}") 2>&- || echo failed in 22 | |
40 | l=t; (echo 23 "${IFS+h$(echo -n i "${IFS+$l}"h)ere}") 2>&- || echo failed in 23 | |
41 | key=value; (echo -n '24 '; printf '%s\n' "${IFS+'$key'}") 2>&- || echo failed in 24 | |
42 | key=value; (echo -n '25 '; printf '%s\n' "${IFS+"'$key'"}") 2>&- || echo failed in 25 # ksh93: “'$key'” | |
43 | key=value; (echo -n '26 '; printf '%s\n' ${IFS+'$key'}) 2>&- || echo failed in 26 | |
44 | key=value; (echo -n '27 '; printf '%s\n' ${IFS+"'$key'"}) 2>&- || echo failed in 27 | |
45 | (echo -n '28 '; printf '%s\n' "${IFS+"'"x ~ x'}'x"'}"x}" #') 2>&- || echo failed in 28 | |
46 | u=x; (echo -n '29 '; printf '<%s> ' foo ${IFS+a"b$u{ {"{ {\}b} c ${IFS+d{}} bar ${IFS-e{}} baz; echo .) 2>&- || echo failed in 29 | |
47 | (echo -n '30 '; printf '<%s> ' ${IFS+foo 'b\ | |
48 | ar' baz}; echo .) 2>&- || (echo failed in 30; echo failed in 31) | |
49 | (echo -n '32 '; printf '<%s> ' ${IFS+foo "b\ | |
50 | ar" baz}; echo .) 2>&- || echo failed in 32 | |
51 | (echo -n '33 '; printf '<%s> ' "${IFS+foo 'b\ | |
52 | ar' baz}"; echo .) 2>&- || echo failed in 33 | |
53 | (echo -n '34 '; printf '<%s> ' "${IFS+foo "b\ | |
54 | ar" baz}"; echo .) 2>&- || echo failed in 34 | |
55 | (echo -n '35 '; printf '<%s> ' ${v=a\ b} x ${v=c\ d}; echo .) 2>&- || echo failed in 35 | |
56 | (echo -n '36 '; printf '<%s> ' "${v=a\ b}" x "${v=c\ d}"; echo .) 2>&- || echo failed in 36 | |
57 | (echo -n '37 '; printf '<%s> ' ${v-a\ b} x ${v-c\ d}; echo .) 2>&- || echo failed in 37 | |
58 | (echo 38 ${IFS+x'a'y} / "${IFS+x'a'y}" .) 2>&- || echo failed in 38 | |
59 | foo="x'a'y"; (echo 39 ${foo%*'a'*} / "${foo%*'a'*}" .) 2>&- || echo failed in 39 | |
60 | foo="a b c"; (echo -n '40 '; printf '<%s> ' "${foo#a}"; echo .) 2>&- || echo failed in 40 |