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
 <10279.1727476502%jacaranda.noi.kre.to@localhost>:
 ...
 || I guess to be entirely POSIX compatible my test should include:
 ||
 ||  tty >/dev/null 2>&1 && tty <&1 >/dev/null 2>&1 &&
 |
 |The second of those would need to be testing (the pre-redirected)
 |stderr, not stdout, interactive shells don't care where stdout has
 |been sent (though the user probably does).
 |
 |But as Steffen (kind of) indicated, "test -t 0 && test -t 2" is
 |probably an easier way than using tty.

(Tiger Lillies, Flying Robert:
  https://www.youtube.com/watch?v=4tPGbHI2GtE)

--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