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

Re: how to find out who I am



On Aug 4,  9:43pm, Andy Spiegl wrote:
}
} I'd like to find a way to let zsh distinguish between us, but
} the environment variable SSH_CLIENT doesn't help because both of us
} log in from workstations with constantly changing IPs.

On Aug 5,  1:18am, Andy Spiegl wrote:
}
} > ssh root@somehost -t REALME=andy exec zsh
} Great.
} Does that have any disadvantages (i.e. any differences) from
} compared with the "normal" ssh root@somehost ???

You might prefer

	ssh root@somehost -t REALME=andy exec zsh -l

to run zsh as a login shell.

Another trick that I've used in the past is to modify the TERM variable,
which is automatically passed across rsh, rlogin and ssh connections,
and then set it back again in the shell startup files.  For example, on
the local machine

	alias ssh='TERM=$LOGNAME/$TERM ssh'

and in .zshrc (or even .zshenv) on the remote machine

	if [[ $TERM = */* ]]; then
	    RPS1=$TERM:h	# For example
	    TERM=$TERM:t
	fi

This has the advantage of being completely transparent to non-interactive
shells (which don't care about $TERM), and it is propagated automatically
in the event you need to do something like

	ssh -t user@firstremote ssh other@secondremote

(which I have sometimes had to do in order to ssh through firewalls).



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