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]

Re: Minor patch to /etc/profile



Le 01/05/2010 05:25, Chris Sutcliffe a écrit :
The PS1 definition for ksh in /etc/profile uses the literal ascii
characters '^[' for the escape sequence as opposed to the single byte
escape control code.  The attached patch corrects that as well as
HOSTNAME not being set correctly (at least for mksh).

the right way to go would be something like :


the current way :
PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD}\033[0m\n$ ')


w/ tilde expansion as bash does :
TILDE=\~
PS1=$(print '\033]0;${TILDE[(1-0${PWD%%@([!/]*|${HOME}*)}1)]:-}${PWD#${HOME}}\n\033[32m${USER}@${HOSTNAME} \033[33m${TILDE[(1-0${PWD%%@([!/]*|${HOME}*)}1)]:-}${PWD#${HOME}}\033[0m\n$ ')


so, you can still print the file w/o side effects

Regards,

Cyrille Lefevre
--
mailto:Cyrille.Lefevre-lists@laposte.net




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


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