Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ZSH: How to detect remoteness?



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