busybox/shell/hush_test/hush-misc/redir1.tests
Denis Vlasenko 552433bc5a hush: fix "var=val >file" not creating file
function                                             old     new   delta
static.null_ptr                                        -       4      +4
run_list                                            2018    2020      +2
handle_dollar                                        667     626     -41
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 6/-41)             Total: -35 bytes
2009-04-04 19:29:21 +00:00

33 lines
731 B
Plaintext
Executable File

rm shell_test_$$ 2>/dev/null
var=bad
var=ok >shell_test_$$
echo "Test 1: var:$var"
test -f shell_test_$$ && echo "File created:ok"
rm shell_test_$$ 2>/dev/null
var=ok
true | var=bad >shell_test_$$
echo "Test 2: var:$var"
test -f shell_test_$$ && echo "File created:ok"
rm shell_test_$$ 2>/dev/null
var=bad
{ var=ok >shell_test_$$; }
echo "Test 3: var:$var"
test -f shell_test_$$ && echo "File created:ok"
rm shell_test_$$ 2>/dev/null
var=ok
{ var=bad >shell_test_$$; } &
usleep 100000
echo "Test 4: var:$var"
test -f shell_test_$$ && echo "File created:ok"
rm shell_test_$$ 2>/dev/null
var=ok
( var=bad >shell_test_$$ )
echo "Test 5: var:$var"
test -f shell_test_$$ && echo "File created:ok"
rm shell_test_$$ 2>/dev/null