tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: interactive shell detection in shrc
Greg A. Woods wrote in
<m1suHsv-0036s2C@more.local>:
|At Fri, 27 Sep 2024 07:14:46 +0700, Robert Elz <kre%munnari.OZ.AU@localhost> wrote:
|Subject: Re: interactive shell detection in shrc
...
|Reading POSIX Issue 7 sh(1) just now I note the following text:
|
| If the -i option is present, or if there are no operands and the
| shell's standard input and standard error are attached to a
| terminal, the shell is considered to be interactive.
|
|So there's nothing in POSIX about login(1) tacking a leading hyphen on
|and using that to trigger the shell to become a login shell.
|
|Indeed from what I can tell POSIX has nothing whatsoever to say about
|"login shells" nor /etc/profile or $HOME/.profile.
|
|I guess to be entirely POSIX compatible my test should include:
|
| tty >/dev/null 2>&1 && tty <&1 >/dev/null 2>&1 &&
| [ "$0" = "$SHELL" ] &&
| _interactive=true
then you have to go Simon J. Gerraty who ensured me that he always
uses -t and i found out then this indeed is very old and usable.
-t 0 && -t 2, thus.
(I think Robert fixed the NetBSD shell to also go 0 and 2 lately.)
(And, dear Robert, i am not looking at the other emails as i am
afraid you have given an answer (and it surely says something like
that the space is a separator put by echo); i had a thinking
coming into my brain when i was doing the dishwash, last night.)
--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