]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/nquote2.tests
Bash-5.2-rc4 release
[thirdparty/bash.git] / tests / nquote2.tests
CommitLineData
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#
7117c2d2
JA
14a=$'a\001b'
15
16e=$'uv\001\001wx'
17
18recho $a
19recho $e
20
21recho ${a/$'\001'/A}
22recho "${a/$'\001'/A}"
23recho ${e/$'\001'/A}
24recho "${e/$'\001'/A}"
25
26recho ${a/b/B}
27recho "${a/b/B}"
28recho ${e/w/W}
29recho "${e/w/W}"
30
31recho ${a//$'\001'/A}
32recho "${a//$'\001'/A}"
33recho ${e//$'\001'/A}
34recho "${e//$'\001'/A}"
35
36recho ${a//b/B}
37recho "${a//b/B}"
38recho ${e//w/W}
39recho "${e//w/W}"
40
41# pos params pat subst
42
43set $e $e
44
45recho ${@/$'\001'/A}
46recho "${@/$'\001'/A}"
47recho ${@/w/W}
48recho "${@/w/W}"
49
50recho ${@//$'\001'/A}
51recho "${@//$'\001'/A}"
52recho ${@//w/W}
53recho "${@//w/W}"
54
55arr[0]=$a
56arr[1]=$e
57
58recho ${arr[0]}
59recho ${arr[1]}
60
61recho ${arr[0]/$'\001'/A}
62recho "${arr[0]/$'\001'/A}"
63recho ${arr[1]/$'\001'/A}
64recho "${arr[1]/$'\001'/A}"
65
66recho ${arr[0]/b/B}
67recho "${arr[0]/b/B}"
68recho ${arr[1]/w/W}
69recho "${arr[1]/w/W}"
70
71recho ${arr[0]//$'\001'/A}
72recho "${arr[0]//$'\001'/A}"
73recho ${arr[1]//$'\001'/A}
74recho "${arr[1]//$'\001'/A}"
75
76recho ${arr[0]//b/B}
77recho "${arr[0]//b/B}"
78recho ${arr[1]//w/W}
79recho "${arr[1]//w/W}"
80
81recho ${arr[@]/$'\001'/A}
82recho "${arr[@]/$'\001'/A}"
83
84recho ${arr[@]/b/B}
85recho "${arr[@]/b/B}"
86recho ${arr[@]/w/W}
87recho "${arr[@]/w/W}"
88
89recho ${arr[@]//$'\001'/A}
90recho "${arr[@]//$'\001'/A}"
91
92recho ${arr[@]//b/B}
93recho "${arr[@]//b/B}"
94recho ${arr[@]//w/W}
95recho "${arr[@]//w/W}"