1 # try running this with bash, ksh, ash, and hush.
3 # simple quoting rules.
13 # quick and painless exit for lash
14 if false; then true; exit; fi
16 # fairly simple command substitution
17 echo `echo -e foo\\\necho bar`
19 echo THIS IS A TEST >foo
20 cat $(echo FOO | tr 'A-Z' 'a-z')
21 cat foo | tr 'A-Z' 'a-z'
22 cat $(echo FOO | tr 'A-Z' 'a-z') | tr 'A-Z' 'a-z'
24 cat foo | if true; then tr 'A-Z' 'a-z'; else echo bar1; fi
25 cat foo | if false; then tr 'A-Z' 'a-z'; else echo bar2; fi
26 if true; then tr 'A-Z' 'a-z'; else echo bar3; fi <foo
27 if false; then tr 'A-Z' 'a-z'; else echo bar4; fi <foo
28 if true || false; then echo foo; else echo bar5; fi
29 if true && false; then echo bar6; else echo foo; fi
31 # basic distinction between local and env variables
33 FOO=bar env | grep FOO
34 echo "but not here: $FOO"
37 echo "yes, here: $FOO"
42 # not quite so basic variables. Credit to Matt Kraai.
52 # interaction between environment variables and if/then and subshells
54 if true; then FOO=new; fi
60 # make sure we can duplicate file descriptors properly
61 echo replacement >foo 2>&1
63 cat doesnt_exist >foo 2>&1
66 # fairly simple example of hush expanding variables too early
72 # ash, lash, and hush do not create wish; bash and ksh do.
73 # Thanks to Tapani Tarvainen <tt@mit.jyu.fi> for this stress test.
79 # The following example shows that hush's parser is
80 # not _really_ Bourne compatible
81 echo "echo Hello World" >"a=b"
88 # assuming the shell wasn't too buggy, clean up the mess
89 rm -f a=b wish fish foo