Results 1 to 4 of 4
I tried to change the colors and information of my bash prompt to(formatted to make it easier to read, normally there are no spaces):
PS1='\e[0;32m[\t]\e[m
\u@\h:
\e[0;35m\w\e[m
\e[0;31m\$ \e[m'
It ...
- 03-15-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 9
.bash_profile Help
I tried to change the colors and information of my bash prompt to(formatted to make it easier to read, normally there are no spaces):
PS1='\e[0;32m[\t]\e[m
\u@\h:
\e[0;35m\w\e[m
\e[0;31m\$ \e[m'
It all seems to work, but when I'm at the prompt, and my command input goes longer than the terminal window can handle, it doesn't go to a newline, instead it overwrites the line it's on.
Thanks for any help.
- 03-16-2009 #2Just Joined!
- Join Date
- Oct 2004
- Posts
- 62
Hi UndeniableRexer,
IMHO your problem of wrapping has no solution (perhaps a Linux "guru" will contradict me,,,), just keep your prompt small in length or go to full screen.
I save my prompts (in color) in .bashrc and they are active as I open a terminal window from home or when I am superuser...
If you are interested, I give again (in this forum) the prompts I'm using...
To test them, just copy/paste PS1 expression to terminal window and execute it....for my home....
# background cyan (46) - char (fg) bold white (37:1)
PS1="\[\033[37;1;46m\]`date "+%a %d"` \w\033[0m\] "
when I am "superuser" (insert in /root./.bashrc - use "superuser")...
# root --> bg red (41) - char (fg) bold white (37:1)
PS1="\[\033[37;1;41m\]`date "+%a %d"` \w\033[0m\] "
Bye.
- 03-23-2009 #3Just Joined!
- Join Date
- Feb 2009
- Posts
- 9
For anyone interested, I found the solution here:
Bash word wrap newline problem - Ubuntu Forums
"To correct this, I identified the non-printing characters by enclosing each non-printing portion of your prompt within an additional set of codes (kind of like brackets). The codes used for this are \[ and \]."
- 03-24-2009 #4Just Joined!
- Join Date
- Oct 2004
- Posts
- 62
Hi UndeniablyRexer.
thanks for having posted the closing post w/ the solution to your problem (as everyone
should do)...
You helped me too! I have found the mistake in my PS1 expression. (the lack of "\[" in front of the 2nd escape).
Now it works correctly! No problem of wrapping any more!
Bye.


Reply With Quote