Hi, When using "named" file descriptors inside a function, the file descriptors are not automatically un-linked when the function returns, but when using regular "numbered" file descriptors they are automatically "destroyed".
Not sure if it's "by" design or why it would be, but attached is a small script to demonstrate the observation. I've tested on all versions available to me at the moment: 4.1.2(1),4.2.26(1), 4.2.37(1), 4.3.11(1) with the same results. I understand that explicitly closing a file descriptor is a best practice, but I'm questioning the fact that the behavior is different for numbered vs named FD. Thanks! Math.
bash-fh-test.sh
Description: Bourne shell script