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

Re: read with redirected stdin

thanks Bart for this explanation and the solution, I wasn't so sure how to explain what I was looking for because I was missing this mechanic.

Pier Paolo Grassi

Il giorno mar 10 gen 2023 alle ore 03:46 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> ha scritto:
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