I customized my bash with this in my bashrc
export PS1="\e[0;36m\h\e[m \e[0;33m\w/\e[m \e[0;31m\n\$ →\e[m "
So I get something like this (with colors) :
Ahuri ~/Public/
$ →
But I am having problems with long commands. When I write a very long command that is longer than a line it starts overwriting my first line
Example :
Ahuri ~/Public/
$ → ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If I continue to add "^" I get:
Ahuri ~/Public/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
my "$ →" is overwritten, and then the whole line gets overwritten.
tput
not seems to add anything special to solve the length calculation: http://pastebin.com/u28RTT5t – manatwork Apr 03 '13 at 12:37\[
and\]
. But this is the better answer (with that omission stated) because the world largely doesn't use boldface to change colour any more. Boldface means boldface. Hardwiring control sequences in imitation of manatwork's answer often nowadays hardwires the wrong control sequences for changing colour; as people think of0;
and1;
as magic, rather than reset-all and boldface. – JdeBP Sep 11 '20 at 07:53