Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ZSH: How to detect remoteness?
- X-seq: zsh-workers 900
- From: "Timothy J. Luoma" <luomat@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- To: rft@xxxxxxxxxxxxxxx
- Subject: Re: ZSH: How to detect remoteness?
- Date: Tue, 9 Apr 1996 13:25:23 -0400 (EDT)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <9604031228.AA05668@xxxxxxxxxxxxxxxxxxxxx>
- Reply-to: luomat@xxxxxxxxxxxxxxxxxxxxxxxxxxx
I am also using NeXTStep, and zsh (obviously ;-)
I have recently devised this as a (foolproof?) way to check to see if you
are local or remotely logged in:
This goes at the top of my .zshenv
APPNAME=`/bin/ps -axlcw | awk '{ pid=$3; ppid[pid]=$4; \
name[pid]=$NF; } END { pid='$$';\
while (name[pid]==name[ppid[pid]]) pid=ppid[pid]; \
print name[ppid[pid]]; }'`
case $APPNAME in
telnetd)
# do stuff for telnet login
;;
rshd)
# do stuff (or nothing) for rsh
;;
inetd)
# if you use RBrowser.app for NeXTStep
;;
Terminal|Stuart)
# this probably means you are on console
;;
*)
# dunno how you'd get here
;;
Actually, I have mine setup so that if it isn't rshd/telnetd/inetd then
assume I am on console...
Ohh.. you may want to check for 'ftpd' also.... I hadn't thought about
that before...
Let me know if you need any help with this.
TjL
--
Timothy J. Luoma <luomat@xxxxxxxxxxxxxxxxxxxxxxxx>
USENET: Please CC this address on replies to my posts, things vanish fast.
NeXT Info available via email! Send message with SUBJECT 'send info'
>>>> Please: No NeXTMail, use MIME for attachments <<<<
Messages sorted by:
Reverse Date,
Date,
Thread,
Author