You are not logged in.
Pages: 1
I have a few lines in my .bashrc that only work if an X server is running, the problem is that whenever I ssh into my box those commands run, fail and puke them to the console. I know I can write a conditional statement for this but I can't find the command to use to check to see if a login is graphical or CLI based.
solution:
if [[ ! -z "$SSH_CONNECTION" ]]
then
stuff that you only want to run when the connection is local
fi
Last edited by brando56894 (2011-09-22 19:26:47)
Offline
Check $TTY (/dev/tty* vs. /dev/pts*) or if $SSH_CONNECTION is set. Checking $DISPLAY is possible, too.
Last edited by jakobm (2011-09-22 17:44:58)
Offline
Thanks!
Offline
Pages: 1