delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/08/13/05:25:55

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <48A2A851.8010303@alice.it>
Date: Wed, 13 Aug 2008 11:24:33 +0200
From: Angelo Graziosi <angelo DOT graziosi AT alice DOT it>
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: On bash prompt
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

In /etc/profile, PS1 for bash is defined as

PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

Indeed I have

$ echo $PS1
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$
^^^^^(1)^^^^^


Now this causes some problems with 'M-x shell' in Emacs: the prompt has 
many garbage characters, like '[33m' etc..

In Emacs this problem could be solved with 'M-x 
ansi-color-for-comint-mode-on', but the sequence (1), i.e.

\[\e]0;\w\a\]

still causes problems.

If one defines PS1 as:

PS1='\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

the prompt one obtains (in Cygwin) is the same as that defined in 
/etc/profile [1] and 'M-x ansi-color-for-comint-mode-on' fixes the thing 
(in M-x shell).

So, just a curiosity, why the extra 'code' (1), above? What the true 
difference between

PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

and

PS1='\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

?


TIA,
    Angelo.

---
[1] Or, at least, I do not see any 'visual' difference.

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019