You are not logged in.
I found a function
function EXT_COLOUR () { echo -ne "\033[38;5;$1m"; }
But it messes up my terminal by suddenly jumping to the beginning of the line instead of breaking the line when text overflows.
And here is my prompt:
`EXT_COLOUR 6`\u`EXT_COLOUR 10` @ `EXT_COLOUR 1`\h`EXT_COLOUR 3`\w `EXT_COLOUR 10` $ \[\e[0m\]
I noticed the more hidden characters (the more colours) I use, the sooner will it bug out and jump at the beginning of the line. Using termite.

So do you know another way to make use of the 256 terminal colours in the PS1 variable? Thanks.
Edit: Another question, but still relevant to this:
http://unix.stackexchange.com/questions … -with-bold - I tested the for loop in a bash file and it worked, but if I write echo -e "\e[38;05;${code}m $code: Test" (replacing code with a number between 0 and 255 ofcourse) in my bash prompt and run, it only prints the output in color 0.
Last edited by Ploppz (2013-12-08 18:10:12)
Offline
I think the problem is that the shell is unable to properly determine the length of the prompt. Try enclosing everything that does not get printed in square brackets:
PS1="\[`EXT_COLOUR 6`\u`EXT_COLOUR 10`\] @ \[`EXT_COLOUR 1`\h`EXT_COLOUR 3`\w `EXT_COLOUR 10`\] $ \[\e[0m\]"I haven't tried that command ^^^, but hopefully you get the idea...
Offline
That did it, thanks! For simplicity, I put \[ and \] Inside the EXT_COLOUR function.
Last edited by Ploppz (2013-12-08 18:12:26)
Offline