tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: interactive shell detection in shrc



Robert Elz wrote in
 <1895.1728442651%jacaranda.noi.kre.to@localhost>:
 |    Date:        Fri, 4 Oct 2024 07:53:59 -0700
 |    From:        George Georgalis <george%galis.org@localhost>
 |    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)


Home | Main Index | Thread Index | Old Index