Mail Archives: cygwin/2001/07/04/01:30:49
I mis-spoke earlier. I didn't mean escape characters. I meant those \[
sequences. Overall, my prompt problems (and probably problems of the
person who originally complained about rxvt) was due to pilot error.
Although to be honest, I still don't understand even after reading the
PROMPTING section of the bash man page (which I did once a long time
ago) how to interpret the default PS1 (which works) but which I changed
since I hated it (I can't stand a prompt that takes up it's own line).
And I changed it incorrectly. Here's the default:
sandman AT BWELCH-W2k ~
$ echo $PS1
\[\033]0;\w\007 \033[32m\]\u@\h \[\033[33m\w\033[0m\] $
^ ^* ^ ^
The man page for bash doesn't mention what un-backslashified [ or ] does
in a prompt (indicated by the ^'s above). And what the heck's 32m
(indicated by the *)? The bash man page never mentions how prompt color
is changed, although I suspect the parts I've indicated above probably
do that magic.
Anyway, I did my own changes to the prompt to get rid of some of the
things I didn't like, but I ended up getting some strange issues when I
did Ctrl-a and Ctrl-e, as well as just using arrow keys. But it was
definitely because I had not set PS1 100% correctly. But I don't think
I ever will unless there's some information source that explains this
stuff better than the bash man page. I mean, putting escape sequences
in prompts is not bash-specific or Cygwin-specific. It's a very common
thing in UNIX, and so I even tried searching through some man pages in
my UNIX box. But sometimes man -k isn't good enough unless you know the
proper terminology for what you're looking for.
So basically, this whole rxvt thing prompted me to do what I should've
done months ago for a number of other reasons (i.e. features in zsh that
bash doesn't have) so it worked out for the best (for me at least; don't
know about the guy who made the original post! ;) ) But I am curious:
where does one find information on all these \[ sequences and what they
do in a vt100 or vt220 or xterm terminal?
-Sandeep
Randall R Schulz wrote:
> Hi,
>
> Here's a little more on the promt business. It has proved popular with
> fellow nerds in my office:
>
> My PS1 for any terminal (emulator) that supports it (xterm, xterm-color,
> vt100, vt102, vt220, cytwin, at least) is this:
>
>
> PS1=$'\[\e]0; \u :: \W (\w)\a\]\!> '
> # Note:
> # This sequence:
> # ESC]0;
> # ^ zero
> # Starts the title setting sequence. Everything from there to
> # the CTRL-G (also "\a" within $'...') is put in the window title.
> # Some terminal emulators (notably TeraTerm) put a pretty stingy
> # limit on how much they'll display, but you don't have to limit
> # the length you attempt to put there
>
>
> I don't mind the information typically put into prompts, but I _hate_ to
> have it literally in the prompt!
>
> Randall
>
>
--
---------------------------------------------
Sandeep V. Tamhankar
Member of Technical Staff
Tel: (408) 220-7505
Fax: (408) 774-2002
Email: sandman AT interwoven DOT com
Visit http://www.interwoven.com
Moving Business to the Web
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -