file descriptor - exec vs inline
by jt1122 from LinuxQuestions.org on (#6H6M8)
Hi,
What's the difference between using file descriptors (fd) with & without exec?
Example:
This reads a single line on fd 5 from file f: Code:read -u5 i 5<fis the fd "auto" closed after the command finishes?.
With exec (fd opened & closed manually):
Code: exec 5<f ; read -u5 i ; exec 5<&-So the difference is that with exec the fd is permanent until it's manually closed?.
Thanks
What's the difference between using file descriptors (fd) with & without exec?
Example:
This reads a single line on fd 5 from file f: Code:read -u5 i 5<fis the fd "auto" closed after the command finishes?.
With exec (fd opened & closed manually):
Code: exec 5<f ; read -u5 i ; exec 5<&-So the difference is that with exec the fd is permanent until it's manually closed?.
Thanks