[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to make colour prompts for pdksh

On 07/25/2006 11:29 AM, Leinier C. Salfran wrote:
El mar, 25-07-2006 a las 17:01 +0200, LeVA escribió:

I want to make my shell's prompt colourful :)

I'm using pdksh. There are tons of information provided by google, but none of them are working.

Setting my prompt to:
PS1=$'\E[31m'$USER@$'\E[1;33m'`hostname -s`:$'\E[0m>'

makes my prompt:

The colour codes gets ignored. Is this only working with the original korn shell? Is there colour support for the public domain korn shell?




Hi .. I never used this but I can say you that you are using 'text
strings' in that variable .. Everything you put enclosed in ' and " is a
'text string' in c, perl, php, bash and others.

PS1=$'\E[31m'$USER@$'\E[1;33m'`hostname -s`:$'\E[0m>'

The result looks like this
PS1=$'\E[31m'$USER@$'\E[1;33m'`hostname -s`:$'\E[0m>'
    $ \E[31m  leva@$ \E[1;33m  leva        :$ \E[0m>

Do you see?

Try to eliminate ' and try .. Maybe it works.

I know /zip/ about {pd}ksh, but, in bash, $'text' is a special syntax that recognizes special character codes such as \E (escape). Under bash, that PS1 string works as expected.

LeVA, it looks like you got advice on how to change the prompt color in bash, but you're using it for pdksh; pdksh probably has a completely different way to change the prompt color.

Reply to: