More shell / quoting testcases from Larry.

This commit is contained in:
Mark Whitley 2001-05-24 23:05:13 +00:00
parent 8b7a0d807a
commit 4f6aea807b
2 changed files with 23 additions and 2 deletions

View File

@ -1,4 +1,19 @@
# try running this with bash, ksh, ash, and hush. # try running this with bash, ksh, ash, and hush.
# simple quoting rules.
echo a b
echo "a b"
echo a "" b
echo a '' b
echo hello?
echo "hello?"
echo t* hello
echo t\* hello
# quick and painless exit for lash
if false; then true; exit; fi
# fairly simple command substitution
echo `echo -e foo\\\necho bar` echo `echo -e foo\\\necho bar`
echo THIS IS A TEST >foo echo THIS IS A TEST >foo
@ -13,7 +28,13 @@ if false; then tr 'A-Z' 'a-z'; else echo bar4; fi <foo
if true || false; then echo foo; else echo bar5; fi if true || false; then echo foo; else echo bar5; fi
if true && false; then echo bar6; else echo foo; fi if true && false; then echo bar6; else echo foo; fi
# ash, lash, and hush do not create fish; bash and ksh do. Tough. # fairly simple example of hush expanding variables too early
unset TMP
rm -f fish
TMP=fish && >$TMP
ls fish
# ash, lash, and hush do not create fish; bash and ksh do.
# Thanks to Tapani Tarvainen <tt@mit.jyu.fi> for this stress test. # Thanks to Tapani Tarvainen <tt@mit.jyu.fi> for this stress test.
unset TMP unset TMP
rm -f fish rm -f fish

View File

@ -306,7 +306,7 @@ sed -e '/test/s/dangerous/PELIGROSO/' testcases
sh -c "echo a b c" sh -c "echo a b c"
sh -c ">" sh -c ">"
sh -c "a" sh -c "a"
#sh sh.testcases sh sh.testcases
# sleep - can't test: produces no output # sleep - can't test: produces no output