blob: 9b5c8da597e2131809d15fc9b7d8ee9086f46af1 [file] [log] [blame]
Mark Whitley04052f92001-05-24 17:15:33 +00001# try running this with bash, ksh, ash, and hush.
Mark Whitley4f6aea82001-05-24 23:05:13 +00002
3# simple quoting rules.
4echo a b
5echo "a b"
6echo a "" b
7echo a '' b
8echo hello?
9echo "hello?"
10echo t* hello
11echo t\* hello
12
13# quick and painless exit for lash
14if false; then true; exit; fi
15
16# fairly simple command substitution
Mark Whitley04052f92001-05-24 17:15:33 +000017echo `echo -e foo\\\necho bar`
18
19echo THIS IS A TEST >foo
20cat $(echo FOO | tr 'A-Z' 'a-z')
21cat foo | tr 'A-Z' 'a-z'
22cat $(echo FOO | tr 'A-Z' 'a-z') | tr 'A-Z' 'a-z'
23
24cat foo | if true; then tr 'A-Z' 'a-z'; else echo bar1; fi
25cat foo | if false; then tr 'A-Z' 'a-z'; else echo bar2; fi
26if true; then tr 'A-Z' 'a-z'; else echo bar3; fi <foo
27if false; then tr 'A-Z' 'a-z'; else echo bar4; fi <foo
28if true || false; then echo foo; else echo bar5; fi
29if true && false; then echo bar6; else echo foo; fi
30
Mark Whitley4f6aea82001-05-24 23:05:13 +000031# fairly simple example of hush expanding variables too early
32unset TMP
33rm -f fish
34TMP=fish && >$TMP
35ls fish
36
37# ash, lash, and hush do not create fish; bash and ksh do.
Mark Whitley04052f92001-05-24 17:15:33 +000038# Thanks to Tapani Tarvainen <tt@mit.jyu.fi> for this stress test.
39unset TMP
40rm -f fish
41TMP=fish >$TMP
42ls fish
43
44# The following example shows that hush's parser is
45# not _really_ Bourne compatible
46echo "echo Hello World" >"a=b"
47unset a
48chmod a+x "a=b"
49PATH=$PATH:.
50"a=b"
51echo $a
52
53# assuming the shell wasn't too buggy, clean up the mess
54rm -f a=b fish foo