]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/nquote5.tests
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / nquote5.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 a=$'ab\001cd\001ef'
15 IFS=$'\001'
16
17 recho $a
18 recho ${a}
19 recho xx${a}yy
20 recho "$a"
21
22 recho $(echo $a)
23 recho $(echo "$a")
24
25 recho ${a%%??}
26 recho "${a%%??}"
27
28 recho ${a/f/}
29 recho "${a/f/}"
30
31 a1=("$a")
32 recho ${a1[0]}
33 recho ${a1}
34
35 recho ${a:2:2}
36
37 set -- $a
38 recho $1 -- $2 -- $3
39
40 set -- "$a"
41 recho $1
42 recho ${1}
43
44 echo "$a" | { IFS=$'\001' read x y z; recho $x -- $y -- $z ; }
45 unset x y z
46 b=$'uv\177wx\177yz'
47
48 recho $b
49
50 recho "ab${x}y${a}z"
51 recho ab${x}y${a}z
52
53 recho "ab${b}y${a}z"
54 recho ab${b}y${a}z
55
56 echo "ab${b}y${a}z" | { IFS=$'\001' read l m n o ; recho $l -- $m -- $n -- $o; }
57 unset l m n o
58
59 a=$'ab\001cd\001ef'
60 b=$'uv\177wx\177yz'
61
62 IFS=$'\177'
63
64 recho $a
65 recho $b
66
67 recho "ab${x}y${b}z"
68 recho ab${x}y${b}z
69
70 recho "ab${b}y${a}z"
71 recho ab${b}y${a}z
72
73 echo "ab${b}y${a}z" | { IFS=$'\001' read l m n o ; recho "$l" -- "$m" -- "$n" -- "$o"; }
74 unset l m n o
75 echo "ab${b}y${a}z" | { IFS=$'\177' read l m n o ; recho "$l" -- "$m" -- "$n" -- "$o"; }
76 unset l m n o