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

Is there a way to find the Remote Host in ZSH?



I am looking for a way to get the complete hostname or IP address where I  
have connected _from_ when making a telnet/ssh/etc connection.

Right now the only thing I can figure out is 'who am i' which doesn't always  
give enough information:

kira!luomat   ttypb    Jun 29 13:16 (cc344191-a.ewnds)

The hostname is the last field, but it isn't complete and I'd prefer not to  
have to do

	REMOTE_HOSTNAME=`who am i | awk '{print $NF}' | tr -d '(|)'`

which is what I am currently using.

Anyway, I have some settings I would like to make specific to when I connect  
from certain IPs, so this would be helpful....

if [ "$REMOTE_IP" = "123.123.12.3" ]; then
	source specialfile
fi	

Something like REMOTE_IP or REMOTE_HOSTNAME (I think tcsh has something like that).

Is there a way to do this already that I just don't know about?

TjL




Messages sorted by: Reverse Date, Date, Thread, Author