[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PS1 has ruined line wrap
From: |
Jonathan Reed |
Subject: |
Re: PS1 has ruined line wrap |
Date: |
Mon, 14 Feb 2011 12:51:34 -0500 |
>
> around all the characters that don't move the cursor
portion immediately after the $PWD
Thanks for the clarity guys. It took me a few minutes to see the matching
[]'s and to escape the correct ones. My syntax highlighting was confusing me
but I think my enemy is that I'm trying to use the [] characters in my
prompt and that they are also control characters here. But heres what I
ended up with and this works.
PS1='[\u@\[\e[1;45m\]\h\[\e[0m\] $PWD\[\e]2;@ \H\a\]]\$ '
I was mainly concerned only with the system name in the title bar to help me
feel in a little more control in my window manager. But you are correct in
saying that my .bashrc workaround is not the proper way to handle my problem
since it does not handle a scenario where multiple logouts are performed
after a chain of logins.
On Mon, Feb 14, 2011 at 9:30 AM, Chet Ramey <chet.ramey@case.edu> wrote:
> On 2/12/11 2:53 PM, Jonathan Reed wrote:
> > An old thread but I found a way around this by adding a line to my
> bashrc:
> >
> > echo -ne "\033]0; `whoami` @ `hostname` \007"
> >
> > The reference
> > http://mdinh.wordpress.com/2010/11/21/xterm-title-bar/
> >
> > On Thu, Nov 25, 2010 at 7:26 PM, Chet Ramey <chet.ramey@case.edu
> > <mailto:chet.ramey@case.edu>> wrote:
> >
> > On 11/25/10 3:38 PM, Jonathan Reed wrote:
> > > I was using this as my ps1
> > > PS1='[\u@\[\e[1;31m\]\h\[\e[0m\]:$PWD]\$ '
>
> That works.
>
> > > But I wanted to label the title of my xterm windows with the
> hostname of
> > > system Im logged into. So I added the following
> > > PS1='[\u@\[\e[1;45m\]\h\[\e[0m\] $PWD]\e]2;@ \H\a\$ '
>
> The portion immediately after the $PWD is probably going to be invisible
> and cause you problems.
>
> Chet
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU chet@case.edu
> http://cnswww.cns.cwru.edu/~chet/
>