I want to change the color of the terminal display when entering a SSH session. In the .bashrc I have a snip that changes the prompt when logging in via SSH, but I need to change the whole background color.
The background will apply only when I'm logged into a remote host via SSH.
This thread has a good discussion on changing colors of the terminal display.
Changing colour of text and background of terminal?
For example the following printf lines in a bash script do exactly what I want - change the color of the line responding to the command and all subsequent lines of that terminal session.
However when included in the .bashrc as below,the effect lasts only for the first line of the session.
if [[ -z "$SSH_CLIENT" ]]
then
:
else
PS1="\[\e[01;36m\]$PS1\[\e[00m\]"
printf '\e[48;5;125m'
printf '\e[38;5;255m'
fi
Where 48 and 38 select foreground and background, the 5 selects the color table to use (in this case ANSI), and nnnm selects the color from the selected color table.
How can I make the change stick through the terminal session.
0 Answers