Imported from ../bash-2.05b.tar.gz.
[platform/upstream/bash.git] / tests / nquote1.tests
1 a=$'a\001b'
2
3 set $a
4
5 b=$a
6 c=$1
7 d="$1"
8
9 e=$'uv\001\001wx'
10
11 recho a $a ${#a}
12 recho 1 $1 ${#1}
13 recho b $b ${#b}
14 recho c $c ${#c}
15 recho d $d ${#d}
16
17 recho a ${a} ${#a}
18 recho 1 ${1} ${#1}
19 recho b ${b} ${#b}
20 recho c ${c} ${#c}
21 recho d ${d} ${#d}
22
23 recho a "$a" ${#a}
24 recho 1 "$1" ${#1}
25 recho b "$b" ${#b}
26 recho c "$c" ${#c}
27 recho d "$d" ${#d}
28
29 recho a "${a}" ${#a}
30 recho 1 "${1}" ${#1}
31 recho b "${b}" ${#b}
32 recho c "${c}" ${#c}
33 recho d "${d}" ${#d}
34
35 set $e
36
37 recho e1 ${e:1:3}
38 recho e2 "${e:1:3}"
39 recho e3 ${1:1:3}
40 recho e4 "${1:1:3}"
41
42 arr[0]=$e
43 arr[1]=$e
44
45 recho a1 ${arr:0:4}
46 recho a2 "${arr:0:4}"
47
48 recho a3 ${arr[@]:0:2}
49 recho a4 "${arr[@]:0:2}"
50
51 set $e $e
52
53 recho p1 ${@:1:2}
54 recho p2 "${@:1:2}"
55
56 recho p1 ${*:1:2}
57 recho p2 "${*:1:2}"
58
59 recho $e
60
61 recho 'uv\ 1\ 1wx'
62
63 f='uv\ 1\ 1wx'
64
65 recho $f
66
67 echo -en "\01" | cat -v
68 echo
69
70 huhu() { echo "$1"; };
71
72 huhu $(echo -en "\01") | cat -v
73 huhu $(echo -en "\02") | cat -v
74
75 f=$'uv\001w\001xy'
76
77 set $f $f
78
79 recho f1 ${f:1:3}
80 recho f2 "${f:1:3}"
81
82 arr[0]=$f
83 arr[1]=$f
84
85 recho a1 ${arr:0:4}
86 recho a2 "${arr:0:4}"
87 recho a3 ${arr[0]:0:4}
88 recho a4 "${arr[0]:0:4}"
89
90 recho e1 ${f:0:4}
91 recho e2 "${f:0:4}"
92
93 recho d1 ${1:2:2}
94 recho d2 "${1:2:2}"
95
96 recho @1 ${@:1:2}
97 recho @2 "${@:1:2}"