]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/nquote.tests
Bash-4.3 patch 7
[thirdparty/bash.git] / tests / nquote.tests
CommitLineData
ccc6cda3
JA
1expect()
2{
3 echo expect "$@"
4}
5
6expect '<^J^J^J>'
7recho $'\n\n\n'
8
bb70624e
JA
9expect '<++^J++>'
10f=$'\n'
11recho "++$f++"
12unset f
13
ccc6cda3
JA
14z1=$''
15expect '<>'
16recho "$z1"
17
18ZIFS=$'\n'$'\t'$' '
19
20expect '<^J^I >'
21recho "$ZIFS"
22
23expect '<abc>'
24recho $'abc'
25
26expect '<^M^[^Gabc>'
27recho $'\r\e\aabc'
28
29D=$"hello"," "$"world"
30
31expect '<hello,> <world>'
32recho $D
33
34expect '<hello, world>'
35recho "$D"
36
37D=$""
38expect '<>'
39recho "$D"
40
41world=chet
42
43expect '<$hello, world>'
44recho \$"hello, world"
45
46expect '<hello, $world>'
47recho $"hello, \$world"
48
49expect '<hello, "world">'
50recho $"hello, \"world\""
51
52expect '<hello, $"world">'
53recho $"hello"', $"world"'
54
55expect '<hello, $"world">'
56recho $'hello, $"world"'
57
58expect '<$hello, chet>'
59recho \$"hello, $world"
60
61expect '<hello, chet>'
62recho $"hello, $world"
d166f048
JA
63
64z=$'\v\f\a\b'
65case "$z" in
66$'\v\f\a\b') echo ok;;
67*) echo bad;;
68esac
bb70624e
JA
69
70# Dave Korn says this should be allowed and echo 'abcd'
71echo $'\'abcd\''
72
73# printf translates \' to ' ...
74printf "\'abcd\'\n"
75
76# but echo -e doesn't
77echo -e "\'abcd\'"
78echo -e "\\'abcd\\'"
79
95732b49 80# and what do we do about unrecognized escape sequences?
bb70624e 81
95732b49
JA
82shopt -s xpg_echo
83
84recho $'A\CB'
85
86recho "A\CB"
87
88cde=c
89recho $'ab$cde'
90
91printf "%b\n" 'A\CB'
92printf 'A\CB\n'
93
94echo 'A\CB'
95
96world=chet
97
98recho $'hello, $"world"'
99recho $'hello, \$"world"'
100recho $'hello, $\"world"'
101
102recho "hello, $"world""
0628567a
JA
103
104# ansi quoting inside double-quoted command subst - bash-3.1 bug
105echo $(set -- $'a b'; echo $#)
106echo "$(set -- $'a b'; echo $#)"
107
108echo "$(echo $';foo')"
109
110args ()
111{
112 for a in "$@";do echo "'$a'";done
113}
114unset mytab
115recho "${mytab:-$'\t'}"
116recho "$( args $'A\tB' )"
0001803f
CR
117
118${THIS_SH} ./nquote1.sub
ac50fbac 119${THIS_SH} ./nquote2.sub