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*

1
  • 2
    (1) I’m glad you realized that the current/controlling tty of a process is not associated with any file descriptor, and is not guaranteed to be open on any fd.  But, did you try the command that you offer as a workaround for that contingency?  When I try it, all I get is /dev/tty, and not the controlling tty (as reported by ps). (2) I believe that { readlink /dev/fd/0; } < /dev/tty is (and will always be) equivalent to readlink /dev/fd/0 < /dev/tty — do you believe otherwise?  If so, can you justify it? (3) The second semicolon in your command (the one after /dev/tty) is unnecessary. Commented Mar 17, 2016 at 3:47