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