Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
From: Andrew DeFaria <Andrew@DeFaria.com>
Subject: Re: Line breaks in bash
Date: Fri, 30 Apr 2004 11:05:29 -0700
Lines: 67
Message-ID: <c6u4h2$i6l$1@sea.gmane.org>
References: <F76C9B2DA2FC4C4CA0A18E288BBCBCF70821786A@nihexchange24.nih.gov> <Pine.GSO.4.56.0404291604050.6532@slinky.cs.nyu.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: 12.9.207.201
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
In-Reply-To: <Pine.GSO.4.56.0404291604050.6532@slinky.cs.nyu.edu>

Igor Pechtchanski wrote:

>On Thu, 29 Apr 2004, Buchbinder, Barry (NIH/NIAID) wrote:
>
>  
>
>>-----Original Message-----
>>    
>>
>>>From: Andrew DeFaria
>>>Sent: Thursday, April 29, 2004 1:18 PM
>>>To: cygwin<at>cygwin<dot>com
>>>Subject: Re: Line breaks in bash
>>>
>>>When I type a long line in the bash shell it seems to get confused when
>>>it passes the first 80 character barrier and does a newline. Below is an
>>>example.
>>>
>>>C09-272-A:# why is it in bash that when I get close to typing 80
>>>characters bash
>>>does som
>>>ething like this?
>>>
>>>Now set my prompt to the hostname as
>>>"\[\e]0;\w\a\e[01;33mC09-272-A:\e[0m". Could this be causing the problem?
>>>      
>>>
>>Maybe you are missing a \] in the prompt.  What you really want is something
>>like this:
>>"\[\e]0;\w\a\e[01;33m\]C09-272-A:\[\e[0m\]"
>>    
>>
Placing a "\" after the "\e" and before the "[01" and "0m" causes those 
functions to fail.

>
>Any sequence of non-printable characters should be enclosed in '\['..'\]'
>for bash to not count it towards the current length of the line.
>  
>
Fixed my prompt to "\[\e]0;\w\a\e[01;33mC09-272-A:\e[0m\]" however the 
problem is the same. The trick is to enclose *only* the unprintable 
characters thus my final resulting PS1 string is: 
"\[\e]0;\w\a\e[01;33m\]C09-272-A:\[\e[0m\]"

>  
>
>>(What are \w and \a doing?  man bash says that they should be the current
>>working directory and a bell, but they don't act like that in this prompt
>>for me.)
>>    
>>
>
>'\e]0;' will set the window title to the string that follows it (up to a
>'\a', so that's the terminator).  So, the above should set the window
>title to the current working directory, and the prompt will be displayed
>as "C09-272-A:".  If you wanted the current working directory displayed in
>the prompt, you could use "\[\e[01;33m\]C09-272-A:\w:\[\e[0m\]" instead.
>	Igor
>  
>
Some people like the directory in the prompt - I like it in the title. 
Directory paths tend to be long, leaving you less and less space to type 
the command in. Also, being a sys adm of many machines I'm often more 
concerned with which machine I'm operating on.
-- 
It doesn't matter what temperature a room is, it's always room temperature.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

