I have configured gnome-terminal
in .bashrc
to have custom colours:
PS1='${debian_chroot:+($debian_chroot)}\[\033[00;37m\][\[\033[00;32m\]\t\[\033[00;37m\]] \[\033[01;34m\]\u\[\033[00;37m\]@\[\033[01;34m\]\h\[\033[00;37m\]:\[\033[01;34m\]\w\[\033[01;32m\]$ '
And this means that when executing something like this:
The output looks like this even though the first line should be white, and was white until I made the command that is typed in also green:
So how can I make the output text colour not be affected by the fact that I have set the command colour to be green? I am running Ubuntu GNOME 15.04 with GNOME 3.16.
Information Update:
I have noticed that when running sudo rkhunter --nocolor --update
the output is all green.
Best Answer
The problem is that you are setting the command to be in green but are not closing the color escape code. Therefore, all subsequent lines, including the output of any commands which do not have their own formatting applied, are shown in that color. As a workaround (source), you could
trap
printing the close code to the DEBUG signal. Add this line to your~/bashrc
That will print
\e[0m
(which will close the open color code). Because it istrap
ped to theDEBUG
signal, it will be executed before any command you run. So, between hitting Enter and the command actually running. As explained inman bash
: