func1.sub 638 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Test that redirections attached to shell functions are printed correctly.
  3. # This was a bug in all bash versions before bash-2.04.
  4. #
  5. f()
  6. {
  7. echo f-x
  8. echo f-y
  9. } >&2
  10. type f
  11. export -f f
  12. ${THIS_SH} -c 'echo subshell; type f'
  13. f2()
  14. {
  15. echo f2-a
  16. f3()
  17. {
  18. echo f3-a
  19. echo f3-b
  20. } >&2
  21. f3
  22. }
  23. type f2
  24. export -f f2
  25. ${THIS_SH} -c 'echo subshell; type f2'
  26. f4()
  27. {
  28. echo f4-a
  29. f5()
  30. {
  31. echo f5-a
  32. echo f5-b
  33. } >&2
  34. f5
  35. } 2>&1
  36. type f4
  37. export -f f4
  38. ${THIS_SH} -c 'echo subshell; type f4'
  39. testgrp()
  40. {
  41. echo testgrp-a
  42. { echo tg-x; echo tg-y; } >&2
  43. echo testgrp-b
  44. }
  45. type testgrp
  46. export -f testgrp
  47. ${THIS_SH} -c 'echo subshell; type testgrp'