Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Yeah, the answer you linked to glossed over the details of what <&3 does under the hood. The point is that in effect the redirection has read read what there is available to be read from fd 3, though under the hood it's a bit messier. read -u 3 would be better. I tried to clarify that answer a bit. Commented Oct 6 at 11:51
  • fds are just the file handles of Unix-land, not that special in the simple cases. Open a file, get an fd, read from/write to the fd, profit. It's the cases about multiple redirections that can screw heads. See e.g. this Q about the order of redirections, but there are others. Commented Oct 6 at 12:02
  • Regarding file descriptors and redirection, I've found this useful: mywiki.wooledge.org/BashGuide/InputAndOutput Commented Oct 8 at 17:10