Article 6H6M8 file descriptor - exec vs inline

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
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments