Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: read with redirected stdin



On Mon, Jan 9, 2023 at 2:47 PM Jim <linux.tech.guy@xxxxxxxxx> wrote:
>
> I haven't seen anything that shows ttys pointing to a process. It may exist, but I don't
> know where you would find it if it does. I just know that processes attach tty devices
> via file descriptors on Linux and Unix systems.

Although the foregoing is correct, once a process is attached to a tty
the corresponding descriptor can be closed or duplicated without
detaching the process from the tty again.  All descendants of that
process form a "process group" (unless one of them explicitly takes
over as a new "group leader") and all processes in a group are
eligible to receive signals such as INT and QUIT and TSTP generated by
the terminal (usually by keyboard interaction).

So Pier wants to know what tty is associated with the current
process's group, not what tty may be performing i/o with any of the
currently open descriptors.  The simplest way to do that is to use the
coreutils "tty" command:  tty < /dev/tty




Messages sorted by: Reverse Date, Date, Thread, Author