[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PS1 has ruined line wrap
From: |
Greg Wooledge |
Subject: |
Re: PS1 has ruined line wrap |
Date: |
Mon, 14 Feb 2011 08:56:59 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Sat, Feb 12, 2011 at 02:53:31PM -0500, 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"
~/.bashrc is only sourced at the beginning of each interactive non-login
shell (and, one hopes, also from your ~/.bash_profile for interactive
login shells).
> > 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]\$ '
PS1 is interpreted *every* time a shell prompt is displayed.
So, a single echo in ~/.bashrc does not serve the same purpose as the PS1
setting. Most people who put xterm title bar stuff in PS1 do so because
it includes $PWD and they want $PWD to show in the title bar.
As Chet said, the correct fix is to put \[ ... \] in PS1 around all
the characters that don't move the cursor within the terminal -- e.g.
an xterm title bar change command.