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

Why can't I get my remote host into a variable?




Zsh 4.2.5 on FreeBSD.  I'm ssh'ing into the FreeBSD machine.

I'm trying to get my remote host into a variable REMOTE_HOST. I have tried both of these in .zshenv:

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

$ who am i
luomat           ttyp0    Nov 30 19:34 (192.168.1.103)

That works on the commandline, but when I try it in .zshenv I get "19:34" or whatever the timestamp is for that session.

Thinking I would be clever, I tried this

TTYSHORT=`echo $TTY |colrm 1 8`
REMOTE_HOST=`w | fgrep $TTYSHORT | awk '{print $3}'`

but that does not work either.

Anyone know how to get this to work in .zshenv?







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