exec.tests 507 B

123456789101112131415161718192021222324252627282930
  1. # make sure we have a way of checking these things
  2. cd /proc/$$/fd || cd /dev/fd || exit 1
  3. [ -e 44 ] && exit 1
  4. exec 44>/dev/null
  5. [ -e 44 ] || exit 1
  6. echo pass fd out open
  7. [ -e 55 ] && exit 1
  8. exec 55>&44
  9. [ -e 55 ] || exit 1
  10. echo pass fd out dup
  11. exec 44>&-
  12. [ -e 44 ] && exit 1
  13. echo pass fd out close
  14. [ -e 66 ] && exit 1
  15. exec 66</dev/null
  16. [ -e 66 ] || exit 1
  17. echo pass fd in open
  18. [ -e 77 ] && exit 1
  19. exec 77<&66
  20. [ -e 77 ] || exit 1
  21. echo pass fd in dup
  22. exec 66<&-
  23. [ -e 66 ] && exit 1
  24. echo pass fd in close