Help on controlling BASH command line

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Sat Jun 4 16:27:56 UTC 2005


On Sat, Jun 04, 2005 at 11:42:48AM -0400, pking123-rieW9WUcm8FFJ04o6PK0Fg at public.gmane.org wrote:
> Hello
> 
> I have noticed over the past 10 years a "feature" about BASH (or 
> probably xterm) that has me mildly annoyed. It is only now that I 
> wish to discuss it since no one I know of has complained about it.
> 
> I like coloured command prompts. My current one is:
>              PS1='\e[1;31m\h\e[m::\e[1;33m\w\e[m \e[1;32m>\e[m'
> Now if I type in a command, say of more than 20 characters, the 
> display goes nuts. That is, the cursor jumps to the previous line on 
> some nonrandom column and continues for another 5 or 6 characters, 
> then jumps to the previous line to that.
> 
> This could be a problem with xterm, although trying it now on a 
> console, there is an earliy linebreak to the line below, so the 
> program running the command line just deals with the bug differently.
> 
> Now, if I type a line, I would like it to be *me* that inserts the 
> carriage returns; not the program. Is there a way to do this?

Try using 'setterm' instead of hardcoded stuffs.  I had bunch of PS1
samples in my .profile, but I removed them years ago due to lack of use.
Best I can recollect is something like
    PS1="\[`setterm -bold on`\]....\[`setterm -default`\]..."

-- 
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
	   http://home.eol.ca/~parkw/thinflash.html
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list