Re: interactive shell detection in shrc

Steffen Nurpmeso <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <20241009185647.iOCl1cwK@steffen%sdaoden.eu>
Robert Elz wrote in
 <[email protected]>:
 |    Date:        Fri, 4 Oct 2024 07:53:59 -0700
 |    From:        George Georgalis <[email protected]>
 |    Message-ID:  <CAHK3FNzAEf5+hZ9Mix_46rermOXBiDj5qN4RzcwF7W=ipWxVZw@mail.\
 |    gmail.com>
 |
 ||> test -t 0
 ||>
 ||> is reliable.
 |
 |It is, for what it is suppposed to do.
 ...

 |and in the script if you do "test -t 0" you'll get "true" - in that
 |script, standard input is a terminal, the same one as the shell from
 |which the script was run from.   Yet the shell running the script is
 |certainly not interactive.   To be interactive, then as well as stderr
 |also needing to be a terminal, the shell needs to be reading its commands
 |from that standard input (being a terminal).   There's no shell operator

Only to mention that dash still uses standard output.

  ...

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.