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