]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/comsub.tests
Bash-5.1 patch 16: fix interpretation of multiple instances of ! in [[ conditional...
[thirdparty/bash.git] / tests / comsub.tests
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 #
14 # command substution parsing tests
15
16 TABSIZE=`grep -v '^[ #]' $CAPS </dev/null | grep -v "^$" | grep -v "^capalias"| grep -v "^infoalias" | wc -l`
17
18 recho `echo ab cd #efg
19 hijkl`
20
21 recho ab$(echo mn; echo op)yz
22
23 a=`echo 'a b c' | sed 's/ /\\
24 /g' | grep 'b'`
25 recho $a
26
27 recho `echo 'a\' b`
28
29 recho `echo '\$' bab`
30
31 recho `echo '\`' ab`
32
33 recho `echo '\\' ab`
34
35 # old-style command substitution parsing compatibility tests -- post bash-3.1
36 recho 'foo \\
37 bar'
38
39 recho 'foo \
40 bar'
41
42 echo `recho sed -e 's/[ :]/\\
43 /g'`
44
45 echo `recho sed -e 's/[ :]/\
46 /g'`
47
48 echo `recho 'foo\\
49 bar'`
50
51 echo `recho 'foo\
52 bar'`
53
54 echo $(recho 'foo\
55 bar')
56
57 # long-standing parse error in all versions up through bash-4.3
58 echo ${foo:-$(echo a{b,c})} >/dev/null
59
60 # parsing problem based on recursively calling bison parser through bash-4.4
61 for (( INDEX=0; INDEX<$((10-$(echo length $V_NAME))); INDEX++ ))
62 do
63 :
64 done
65
66 # problem with four-character words followed by a metachar through bash-4.4
67 comsub_foo_1()
68 {
69 echo $(while true; do case $HOME in /*) echo abs ;; esac; done)
70 }
71
72 ${THIS_SH} ./comsub1.sub
73 ${THIS_SH} ./comsub2.sub
74 ${THIS_SH} ./comsub3.sub
75 ${THIS_SH} ./comsub4.sub