You are not logged in.
Pages: 1
Is there a way to, in a BASH script, check to see if the current session is SSH vs. local at all?
Offline
Offline
I don't know if this always works, but I think you can check to see if the SSH_CONNECTION variable is set. (edit: Mike beat me to it )
You can also check to see if the DISPLAY variable is set to see if the session was started from X.
Last edited by jowilkin (2009-12-07 06:49:24)
Offline
Thanks for the help. I used the SSH_TTY environment variable to carry out the test with a simple if statement:
if [ $SSH_TTY ];
It works.
Offline
Pages: 1