improve of cmpl.
[bush.git] / tests / quote.tests
blob9ddcd06704a2f36fa6f3b411632583e700e417f0
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.
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.
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/>.
14 echo "Single Quote"
15 echo 'foo
16 bar'
17 echo 'foo
18 bar'
19 echo 'foo\
20 bar'
22 echo "Double Quote"
23 echo "foo
24 bar"
25 echo "foo
26 bar"
27 echo "foo\
28 bar" 
30 echo "Backslash Single Quote"
31 echo `echo 'foo
32 bar'`   
33 echo `echo 'foo  
34 bar'`   
35 echo `echo 'foo\
36 bar'`  
38 echo "Backslash Double Quote"
39 echo `echo "foo
40 bar"`
41 echo `echo "foo
42 bar"`
43 echo `echo "foo\
44 bar"`
46 echo "Double Quote Backslash Single Quote"
47 echo "`echo 'foo
48 bar'`"
49 echo "`echo 'foo
50 bar'`"
51 echo "`echo 'foo\
52 bar'`"
54 echo "Dollar Paren Single Quote"
55 echo $(echo 'foo
56 bar')
57 echo $(echo 'foo
58 bar')
59 echo $(echo 'foo\
60 bar')
62 echo "Dollar Paren Double Quote"
63 echo $(echo "foo
64 bar")
65 echo $(echo "foo
66 bar")
67 echo $(echo "foo\
68 bar")
70 echo "Double Quote Dollar Paren Single Quote"
71 echo "$(echo 'foo
72 bar')"
73 echo "$(echo 'foo
74 bar')"
75 echo "$(echo 'foo\
76 bar')"
78 # old-style command substitution parsing compatibility tests -- post bush-3.1
79 recho 'foo \\
80 bar'
82 recho 'foo \
83 bar'
85 echo `recho sed -e 's/[ :]/\\
86 /g'`
88 echo `recho sed -e 's/[ :]/\
89 /g'`
91 echo `recho 'foo\\
92 bar'`
94 echo `recho 'foo\
95 bar'`  
97 echo $(recho 'foo\
98 bar')
100 a=`echo 'a b c' | sed 's/ /\\
101 /g' | grep 'b'`
102 echo $a
103 a=`echo 'a b c' | sed 's/ /\\
104 /g'`
105 echo "$a"
107 recho `echo 'a\' b`
109 recho `echo '\$' bab`
110 recho `echo '\$foo' bab`
111 recho `echo '$foo' bab`
113 recho `echo '\`' ab`
115 recho `echo '\\' ab`
117 echo `echo '${'`
119 recho `echo "(\\")"`
120 # produces no output
121 : `: "\\""`
122 # ultimate workaround
123 recho `echo "(\")"`
125 # various strings ending in backslashes
127 echo 'string \'
128 echo "string \\"
130 echo string\ \\
132 echo ${foo:-'string \'}
133 echo "${foo:-string \\}"
134 echo ${foo:-string \\\}}
136 ${THIS_SH} ./quote1.sub
137 ${THIS_SH} ./quote2.sub
138 ${THIS_SH} ./quote3.sub
139 ${THIS_SH} ./quote4.sub