]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/comsub1.sub
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / comsub1.sub
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 : $(echo \;)
15
16 : $(case a in a) echo ;;# comment
17 esac)
18
19 : $(case a in a) echo ;; # comment
20 esac)
21
22 : $(: \;# not a comment )
23
24 : $(: \ # not a comment)
25
26 echo $(case a in a) echo \#esac ;;
27 esac)
28
29 : $(case a in a) : ;#esac ;;
30 esac)
31
32 : $(case a in a) : ;#esac comment )
33 esac)
34
35 : $(case a in a) : ;
36 esac)
37
38 echo $(#comment )
39 echo a)
40
41 echo $(case a in (a) echo ok 1;; # comment
42 esac)
43
44 echo $(case a in (a) echo ok 2;; # comment
45 (b) echo moo;;
46 esac)
47
48 echo $(case a in (a) echo ok 3 # comment
49 ;;
50 esac)
51
52 echo $(case a in a) echo ok 4;; # comment
53 esac)
54
55 echo $(case a in a) echo ok 5;; # comment
56 b) echo moo;;
57 esac)
58
59 echo $(case a in (a) echo ok 6 # comment
60 ;;
61 esac)
62
63 echo $( # we just took and pasted in some
64 # code from another script inside a
65 # command substitution
66 echo xyz
67 )
68
69 # problem with parse_comsub through bash-4.4
70 case $(echo $$'x\nx') in
71 x*) echo bad 7;;
72 *) echo ok 7;;
73 esac