On Friday, 3 December 2021 12:08:05 GMT tastytea wrote: > On 2021-12-03 11:17+0000 Peter Humphrey <[email protected]> wrote: > > Hello list, > > > > Is there a way to set the colour of a bash prompt according to > > whether the user has SSH'd in? > > > > This machine is a compile host for some others on the LAN, and it > > would be helpful if it were more obvious that I'm connected to > > another machine. Of course, the standard prompt tells me the machine > > name, but something more conspicuous would help. > > When you are connected via SSH, the environment variable SSH_CONNECTION > is set. I store the color in a variable and set it to yellow if > `[[ -n "${SSH_CONNECTION}" ]]`. I can't give you the exact snippet > since I use Zsh, but it should be possible to use a variable as color > in bash's prompt? > > Kind regards, tastytea
This link expands upon tastytea's idea: https://unix.stackexchange.com/questions/217270/change-ps1-color-when-connected-to-other-host-via-ssh
signature.asc
Description: This is a digitally signed message part.

