[Top][All Lists]

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

Re: how to workaroun 'nl' being added to input-line after 49 characters.

From: Linda Walsh
Subject: Re: how to workaroun 'nl' being added to input-line after 49 characters....
Date: Mon, 14 Feb 2011 10:29:19 -0800
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Thunderbird/ Mnenhy/

Bob Proulx wrote:
Linda Walsh wrote:
But anyway, something else is is awry.

Now my root prompt, instead of being red, looks like:

"\[\033[1m\]\[\033[31m\]Ishtar:root#\[\033[0m\] "


That will be due to incorrect quoting.  Which suggestion did you
implement?  There were several.

What version of bash has the \[ \] characters to keep it from
counting chars?

All of them.

Try this *exactly* as I post it.  I did test this.  It probably isn't
optimal.  But it does what you are asking.  And it is only a slight
variation from what you are currently using.

   _CRed=$(tput setaf 1)  #Red
   _CRST=$(tput sgr0)   #Reset
   _CBLD=$(tput bold)   #Bold
   [[ $UID -eq 0 ]] && {
   PS1='\[$_prompt_open\]$(pwd "$PWD")$_prompt\[$_prompt_close\] ';

I had been using the version w/single quotes:
# _CRed='\[\033[31m\]'  #Red
# _CRST='\[\033[0m\]'  #Reset
# _CBLD='\[\033[1m\]'  #Bold
Your version works better because I am slowing starting to understand.
My initial change added the above single quotes and nothing else.  You
changed the PS1 string as well.
Going from:
 PS1='${_prompt_open}$(spwd "$PWD")${_prompt_close} ';
 PS1='\[$_prompt_open\}$(spwd "$PWD")[$_prompt_close\] ';

So if I understand why the single quoted version didn't work
I'll probably understand why my final problem doesn't work (It's better!)

A string I didn't have in the example because I didn't think it pertinent, was where the 'dashed line is, above', I had:
        PUBLIC _disp_port=${DISPLAY/[^:]*:/}
Which doesn't display any hidden charcters, but no longer displays.
So what's the deal here...none of the vars-in-curls expand
but are changed to something different?
Since the above prints, (as well as the directory, and 2 character suffix ("> " or # ") print, should they also be included in the 'ignore' all chars

Answer: (Nope... am in a line with about a 28 character prompt and it wraps 
about 24 characters into the 2nd line back to the start of the 2nd line, 
overwriting itself.... looking something like:

\}home/tools/../work/src[# 2345678901234567890123456789012345678901234567890123
0wrap around67890123456789 ^column 0 where the 0 is

But this is very excellent...
What I don't understand is why you sub'ed in the square bracket...oh
nevermind...don't ned the curlies for simple var...oh...you did unquote the
path parth...must just be the DISPLAY part throwing it off...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]