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.

3
  • Is it sufficient for the first command to have no process? What about ls | ( /bin/echo hi; /bin/cat ) which runs echo and cat as separate processes, but cat still reads stdin from ls instead of /bin/echo? Commented Aug 17, 2012 at 13:31
  • If the first command is not a builtin, the shell will have to do an extra fork. But that doesn't matter, because children inherit their parents' file descriptors. Commented Aug 17, 2012 at 13:35
  • Thanks! To elaborate on your answer even further: I checked the cd's definition in IEEE Std 1003.1-2008. In the "STDIN" and "STDOUT" sections it says both streams are (almost always) not used by cd. Commented Aug 17, 2012 at 13:42