Re: Strange behavior with PS1 prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 17, 2009 at 18:16, Todd Zullinger <tmz@xxxxxxxxx> wrote:
Donald Russell wrote:
> On Sat, Oct 17, 2009 at 11:36, Petrus de Calguarium <kwhiskerz@xxxxxxxxx> wrote:
>> Donald Russell wrote:
>>
>>> Any ideas/suggestions?
>>
>> None, except to report the bug.
>>
>> I have noticed this problem on and off for years and it doesn't
>> have anything to do with the PS1 prompt. Try entering nothing on
>> the command line, then use the up and down arrows, and eventually
>> your prompt will pick up some stuff from a previous command,
>> although, if you press the backspace, you will see that the input
>> mark is as far left as it can go.
>
> OK, thanks... I really only noticed this after putting newlines etc in
> my PS1 prompt, or at least it got more bothersome then.
>
> I'll file a bug against bash...

I don't think this is a bug.  Rather, I think the problem is caused by
not escaping the color codes you have embedded in your prompt.  Try
this instead:

export PS1="\n\[\033[0;35m\][\u@\h] ${PWD}\n$\[\033[0m\]"

The \[ and \] begin and end a series of non-printable characters.
This tells bash not to count those characters when determining the
length of the prompt.  So the color escape sequences are wrapped in \[
and \].


That makes sense since this problem really only started showing up regularly when I changed my PS1 prompt to use color.

Thank you. :-)
-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux