~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to tests/nquote.tests

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

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