escape codes in ksh "\033]0;\$PWD\007\$PWD> "

Brian Dessent brian@dessent.net
Wed Nov 23 02:40:00 GMT 2005


Robert Body wrote:

> I have not been able to figure out how to send escape codes to ksh
> 
> I saw a syntax for ksh on
> http://www.steveshilling.pwp.blueyonder.co.uk/scripts/xtermtitle.txt
> ---------
> PS1='^[]0;${USER}@${HOST}: ${PWD}^Gksh$ '

I don't think ksh supports pasrsing of escape characters in environment
variables - but you'd have to ask Igor to be sure.  That means you have
to insert the literal escape character.

When you do this most shells will display it as "^[" even though it's
actually just one character, which is the source of your confusion.  For
example, at a bash prompt:

PS1='^[[33mYellow! $ ' ksh

(where again ^[ is not "^" and "[" but control-v then escape)

But what you probably want to do is set this in the .profile or
whatever.  To do that you'll have to do whatever incantation your chosen
text editor uses for inserting raw characters.  I think vim uses ^V too
- but I don't know because I don't use vim.

Brian

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



More information about the Cygwin mailing list