pipefail.tests 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. echo Default:
  2. echo "true | true:"
  3. true | true; echo $?
  4. ! true | true; echo $?
  5. echo "true | false:"
  6. true | false; echo $?
  7. ! true | false; echo $?
  8. echo "false | true:"
  9. false | true; echo $?
  10. ! false | true; echo $?
  11. echo "exit 2 | exit 3 | exit 4:"
  12. exit 2 | exit 3 | exit 4; echo $?
  13. ! exit 2 | exit 3 | exit 4; echo $?
  14. echo Pipefail on:
  15. set -o pipefail
  16. echo "true | true:"
  17. true | true; echo $?
  18. ! true | true; echo $?
  19. echo "true | false:"
  20. true | false; echo $?
  21. ! true | false; echo $?
  22. echo "false | true:"
  23. false | true; echo $?
  24. ! false | true; echo $?
  25. echo "exit 2 | exit 3 | exit 4:"
  26. exit 2 | exit 3 | exit 4; echo $?
  27. ! exit 2 | exit 3 | exit 4; echo $?
  28. echo Pipefail off:
  29. set +o pipefail
  30. echo "true | true:"
  31. true | true; echo $?
  32. ! true | true; echo $?
  33. echo "true | false:"
  34. true | false; echo $?
  35. ! true | false; echo $?
  36. echo "false | true:"
  37. false | true; echo $?
  38. ! false | true; echo $?
  39. echo "exit 2 | exit 3 | exit 4:"
  40. exit 2 | exit 3 | exit 4; echo $?
  41. ! exit 2 | exit 3 | exit 4; echo $?
  42. echo Done