Category Archives: shell scripting

Logged in through ssh?

I've recently come across a problem where I have to check (using bash scripting) whether I am logged in remotely (through ssh, since I only use ssh for that purpose) or locally. This is particularly useful if you have many machines with the same color scheme of bash prompt (and you want to keep it that way), but work on all of them from your local computer.

In this post I'm going to show you how I decided to modify the bash prompt so that I'm sure whether I'm working locally or remotely.

Continue reading Logged in through ssh?