Re: [OT] Bold prompts in bash (SOLVED: Problem with /usr/X11R6/bin/xterm)
Re: [OT] Bold prompts in bash (SOLVED: Problem with /usr/X11R6/bin/xterm)
- Subject: Re: [OT] Bold prompts in bash (SOLVED: Problem with /usr/X11R6/bin/xterm)
- From: "Cook, Rich" <email@hidden>
- Date: Wed, 8 Dec 2010 11:23:12 -0800
- Acceptlanguage: en-US
- Thread-topic: [OT] Bold prompts in bash (SOLVED: Problem with /usr/X11R6/bin/xterm)
Makes sense. Also your method nicely documents the effect you are creating, which is pretty inscrutable in my case.
On Dec 7, 2010, at 5:18 PM, Jeremy Huddleston wrote:
> Right, but I worry about them at a higher level and then never come back to them ;)
>
> On Dec 7, 2010, at 16:59, Cook, Rich wrote:
>
>> Ah, but you are worrying about "all those rules." Specifically, it's the single rule that non-printing characters be enclosed by \[ and \]...
>>
>> On Dec 7, 2010, at 9:56 AM, Jeremy Huddleston wrote:
>>
>>> I have the following in my environment to help my construct my prompt. That way I don't need to worry about all those rules ;)
>>>
>>> ANSI_NORMAL="\[\033[0m\]"
>>>
>>> ANSI_HILITE="\[\033[1m\]"
>>> ANSI_INVERSE="\[\033[7m\]"
>>> ANSI_BLINK="\[\033[5m\]"
>>> ANSI_UNDERSCORE="\[\033[4m\]"
>>>
>>> ANSI_INV_BLINK="\[\033[7;5m\]"
>>> ANSI_INV_HILITE="\[\033[1;7m\]"
>>> ANSI_BLINK_HILITE="\[\033[1;5m\]"
>>> ANSI_INV_BLINK_HILITE="\[\033[1;5;7m\]"
>>>
>>> # Foreground colors
>>>
>>> ANSI_BLACK="\[\033[30m\]"
>>> ANSI_RED="\[\033[31m\]"
>>> ANSI_GREEN="\[\033[32m\]"
>>> ANSI_YELLOW="\[\033[33m\]"
>>> ANSI_BLUE="\[\033[34m\]"
>>> ANSI_MAGENTA="\[\033[35m\]"
>>> ANSI_CYAN="\[\033[36m\]"
>>> ANSI_WHITE="\[\033[37m\]"
>>>
>>> # Background colors
>>>
>>> ANSI_BBLACK="\[\033[40m\]"
>>> ANSI_BRED="\[\033[41m\]"
>>> ANSI_BGREEN="\[\033[42m\]"
>>> ANSI_BYELLOW="\[\033[43m\]"
>>> ANSI_BBLUE="\[\033[44m\]"
>>> ANSI_BMAGENTA="\[\033[45m\]"
>>> ANSI_BCYAN="\[\033[46m\]"
>>> ANSI_BWHITE="\[\033[47m\]"
>>>
>>>
>>> On Dec 7, 2010, at 01:49, Harald Hanche-Olsen wrote:
>>>
>>>> + "Cook, Rich" <email@hidden>:
>>>>
>>>>> AHA! I unset PS1 variable and the problem is gone.
>>>>> Here is what it was set to:
>>>>>
>>>>> cook47@rcmac (cuda-install): echo $PS1
>>>>> \e[37;40;1m\[\033]0;\u@\h (\w)\007\]\u@\h (\W):
>>>>
>>>> The \[...\] construct is supposed to help with that, but you're using
>>>> it in a funny way. You're supposed to put every part of the prompt
>>>> that does not contribute to the width of the prompt inside, the rest
>>>> outside. See the PROMPTING section of the bash man page.
>>>>
>>>> (I don't use bash myself, but a bit of googling led me to
>>>>
>>>> http://www.tek-tips.com/viewthread.cfm?qid=1560209&page=12
>>>>
>>>> which explains it some.)
>>>>
>>>> - Harald
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> X11-users mailing list (email@hidden)
>>>>
>>>> This email sent to email@hidden
>>>
>>
>> --
>> ✐Richard Cook
>> ✇ Lawrence Livermore National Laboratory
>> Bldg-453 Rm-4024, Mail Stop L-557
>> 7000 East Avenue, Livermore, CA, 94550, USA
>> ☎ (office) (925) 423-9605
>> ☎ (fax) (925) 423-6961
>> ---
>> Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept.
>> (opinions expressed herein are mine and not those of LLNL)
>>
>>
>>
>
--
✐Richard Cook
✇ Lawrence Livermore National Laboratory
Bldg-453 Rm-4024, Mail Stop L-557
7000 East Avenue, Livermore, CA, 94550, USA
☎ (office) (925) 423-9605
☎ (fax) (925) 423-6961
---
Information Management & Graphics Grp., Services & Development Div., Integrated Computing & Communications Dept.
(opinions expressed herein are mine and not those of LLNL)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden