Is there a way to have one command run differently, depending on the manner in which one is logged into the session launching it? Basically, we have a command that when run, launches vim to display a file.  I would like it to run using vim if I'm connected via ssh, and macvim if I am on the console.I can write the script, but I can't find how to get the console or the ptty.  w lists all sessions.  Thanks.
Command Run Differently Depending on How Logged In?
bash;shell script