diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-06-07 20:42:05 +0400 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-06-07 20:42:05 +0400 |
commit | 04407e522b43c37198c8a821723950470d0919f5 (patch) | |
tree | 26d6ed9beac36d72c4423ae6eddfdd7bf31a43c4 /tests | |
parent | 4f3e24979bfa8f6a954d5222c7508545c42867e0 (diff) |
Another hush update from Larry:
Fixes the interaction between if/then/else/fi syntax and variables.
I planned to do it right from the beginning, but my implementation
was buggy. Also adds the relevant test cases. Also adds some old
Matt Kraai variable test cases that got left out somehow.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sh.testcases | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/sh.testcases b/tests/sh.testcases index 88e709f87..e2a75873e 100644 --- a/tests/sh.testcases +++ b/tests/sh.testcases @@ -28,6 +28,35 @@ 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 bar6; else echo foo; fi +# basic distinction between local and env variables +unset FOO +FOO=bar env | grep FOO +echo "but not here: $FOO" +FOO=bar +env | grep FOO +echo "yes, here: $FOO" +FOO= +echo a $FOO b +echo "a $FOO b" + +# not quite so basic variables. Credit to Matt Kraai. +unset FOO +FOO=bar +export FOO +env | grep FOO +unset FOO +export FOO=bar +FOO=baz +env | grep FOO + +# interaction between environment variables and if/then and subshells +FOO=default +if true; then FOO=new; fi +echo $FOO +FOO=default +(FOO=bogus) +echo $FOO + # make sure we can duplicate file descriptors properly echo replacement >foo 2>&1 cat foo |