This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

On bash prompt


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]