Denis Vlasenko | 552433b | 2009-04-04 19:29:21 +0000 | [diff] [blame] | 1 | rm shell_test_$$ 2>/dev/null |
| 2 | var=bad |
| 3 | var=ok >shell_test_$$ |
| 4 | echo "Test 1: var:$var" |
| 5 | test -f shell_test_$$ && echo "File created:ok" |
| 6 | |
| 7 | rm shell_test_$$ 2>/dev/null |
| 8 | var=ok |
| 9 | true | var=bad >shell_test_$$ |
| 10 | echo "Test 2: var:$var" |
| 11 | test -f shell_test_$$ && echo "File created:ok" |
| 12 | |
| 13 | rm shell_test_$$ 2>/dev/null |
| 14 | var=bad |
| 15 | { var=ok >shell_test_$$; } |
| 16 | echo "Test 3: var:$var" |
| 17 | test -f shell_test_$$ && echo "File created:ok" |
| 18 | |
| 19 | rm shell_test_$$ 2>/dev/null |
| 20 | var=ok |
| 21 | { var=bad >shell_test_$$; } & |
Mike Frysinger | 9052600 | 2009-04-06 12:34:27 +0000 | [diff] [blame] | 22 | # cant use usleep as it isnt standard in $PATH -- |
| 23 | # we fail when testing busybox compiled solely as "hush" |
| 24 | sleep 1 |
Denis Vlasenko | 552433b | 2009-04-04 19:29:21 +0000 | [diff] [blame] | 25 | echo "Test 4: var:$var" |
| 26 | test -f shell_test_$$ && echo "File created:ok" |
| 27 | |
| 28 | rm shell_test_$$ 2>/dev/null |
| 29 | var=ok |
| 30 | ( var=bad >shell_test_$$ ) |
| 31 | echo "Test 5: var:$var" |
| 32 | test -f shell_test_$$ && echo "File created:ok" |
| 33 | |
| 34 | rm shell_test_$$ 2>/dev/null |