redir1.tests 962 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. rm shell_test_$$ 2>/dev/null
  2. var=bad
  3. >shell_test_$$ var=ok
  4. echo "Test 0: var:$var"
  5. test -f shell_test_$$ && echo "File created:ok"
  6. rm shell_test_$$ 2>/dev/null
  7. var=bad
  8. var=ok >shell_test_$$
  9. echo "Test 1: var:$var"
  10. test -f shell_test_$$ && echo "File created:ok"
  11. rm shell_test_$$ 2>/dev/null
  12. var=ok
  13. true | var=bad >shell_test_$$
  14. echo "Test 2: var:$var"
  15. test -f shell_test_$$ && echo "File created:ok"
  16. rm shell_test_$$ 2>/dev/null
  17. var=bad
  18. { var=ok >shell_test_$$; }
  19. echo "Test 3: var:$var"
  20. test -f shell_test_$$ && echo "File created:ok"
  21. rm shell_test_$$ 2>/dev/null
  22. var=ok
  23. { var=bad >shell_test_$$; } &
  24. # cant use usleep as it isnt standard in $PATH --
  25. # we fail when testing busybox compiled solely as "hush"
  26. wait
  27. echo "Test 4: var:$var"
  28. test -f shell_test_$$ && echo "File created:ok"
  29. rm shell_test_$$ 2>/dev/null
  30. var=ok
  31. ( var=bad >shell_test_$$ )
  32. echo "Test 5: var:$var"
  33. test -f shell_test_$$ && echo "File created:ok"
  34. rm shell_test_$$ 2>/dev/null