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

Re: Detecting whether one is using SSH



On Tue, 17 Nov 2009, Renà 'Necoro' Neumann wrote:

> Hi,
> 
> I'm just wondering if it is possible to detect whether one is logged in 
> via SSH. I want to use it to switch to a different prompt color in that 
> case.

Personally, I use the test: [ -n "$SSH_CLIENT" ]

e.g.:
[ -n "$SSH_CLIENT" ] && prompt_color=green || prompt_color=blue

Best,
Ben


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