]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/comsub-posix.tests
Bash-5.0 patch 11: fix quoted null character removal in operands of conditional ...
[thirdparty/bash.git] / tests / comsub-posix.tests
1 : ${HOME:=/}
2
3 # works right
4 echo ab$(echo mnop)yz
5 # works right
6 echo ab$(echo mnop
7 )yz
8 #
9 # works right
10 echo $(echo ab
11 )
12 # works right
13 echo $(
14 )
15 echo $()
16 echo ab$()cd
17
18 echo $(case a in (a) echo sh_352.26ax; esac )
19 echo $(case a in (a) echo sh_352.26ay; esac)
20
21 echo $((echo sh_352.25a);(echo sh_352.25b))
22
23 echo $(echo sh_352.27 ')' ")" \)
24 # ) comment
25 )
26
27 echo $(
28 echo abc # a comment with )
29 )
30
31 echo $(
32 cat <<eof
33 here doc with )
34 eof
35 )
36
37 echo $(
38 echo ')'
39 )
40
41 unset x
42 x=$(cat <<"EOF"
43 bad' syntax
44 EOF
45 )
46 echo "$x"
47 unset x
48
49 echo $(for f in \); do echo a; done )
50 echo $(case a in a) echo sh_352.26a; esac )
51 echo $(case a in a) echo sh_352.26a; esac)
52
53 echo $(case a in
54 (a) echo sh_352.26
55 ;;
56 esac
57 )
58
59 echo $(case a in
60 a) echo sh_352.26
61 ;;
62 esac
63 )
64
65
66 echo $(case a in
67 a) echo sh_352.26
68 ;;
69
70
71
72
73
74 esac
75
76 )
77
78 echo $(( 4<(2+3) ? 1 : 32))
79
80 echo $(cat << end
81 sh_352.28 )
82 end
83 )
84
85 echo $(cat <<- end
86 sh_352.28 )
87 end
88 )
89
90 k=$(case x in x) echo k;; esac)
91 echo $k
92
93 x=$(
94 case $(ls) in
95 example) echo foobix;;
96 esac
97 )
98
99 echo $( echo ab\
100 cd)
101
102 echo `echo ab
103 cd`
104
105 echo `echo ab #xyz
106 cd`
107
108 echo "$(echo abcde)
109 "
110
111 recho "$(echo abcde)
112 "
113
114 echo $(echo abcde)\
115 foo
116
117 recho $(echo abcde)\
118 foo
119
120 recho "wx$(echo abcde)yz"
121 recho "$(echo abcde)"
122
123 echo $(cat <<eof
124 '
125 eof
126 )
127
128 echo after 1
129
130 echo $(cat <<\eof
131 '
132 eof
133 )
134
135 echo after 2
136
137 echo "$(cat <<\eof
138 '
139 eof
140 )"
141
142 echo after 3
143
144 echo "$(cat <<\eof
145 `
146 eof
147 )"
148
149 echo after 4
150
151 echo $(
152 cat << ')'
153 hello
154 )
155 )
156
157 echo after 5
158
159 echo $(cat <<'eof'
160 '
161 eof
162 )
163
164 echo after 6
165
166 echo $(
167 case x in x) echo x;; esac
168 )
169
170 echo $(
171 case x in (x) echo x;; esac
172 )
173
174 echo $(
175 echo 'quoted )'
176 )
177
178 echo $(
179 echo comment # with )
180 )
181
182 echo $(
183 cat <<\eof
184 here-doc with )
185 eof
186 )
187
188 echo $(
189 cat <<\)
190 here-doc terminated with a parenthesis
191 )
192 )
193
194 echo $(
195 cat <<\eof
196 ' # or a single back- or doublequote
197 eof
198 )
199
200 ${THIS_SH} ./comsub-posix1.sub
201
202 ${THIS_SH} ./comsub-posix2.sub
203
204 ${THIS_SH} ./comsub-posix3.sub
205
206 # produced a parse error through bash-4.0-beta2
207 : $(echo foo)"
208 "
209 # produced a parse error through bash-4.1
210 unset x
211 x=$(
212 echo yes
213 # a comment with " ' \
214 )
215 echo $x
216 unset x
217
218 # fixed after bash-4.0 released
219 : $(case a in a) echo ;; # comment
220 esac)
221
222 # fixed after bash-4.3 released
223 testing=$(
224 echo test | while read line; do
225 case $line in
226 test) echo saw test ;;
227 *) echo other ;;
228 esac
229 done
230 )
231
232 # recommended to be parsed as a nested comsub instead of arithsub
233 echo $(( echo ab cde ) )