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

man pdksh, I don't understand this - [ was: how to make colour prompts for pdksh ]



Hi!


"... Note that since the command line editors try to figure out how long 
the prompt is  (so  they  know how far it is to edge of the screen), 
escape codes in the prompt tend to mess things up. ..."

Okay, I get it, I'm using escape codes, so I need the following hack.

"... You can tell the shell not to count certain sequences (such as 
escape codes) by  prefixing your prompt with a non-printing character 
(such as control-A) followed by a carriage return and then delimiting 
the escape codes with this non-printing  character."

I've put my escape character to a variable to make things cleaner:

ESC="^"

So if I have a simple prompt like this:

PS1='$ESC[01;32m$USER> '

now if I prefix my prompt with a non-printing char (with control-A like 
suggested) then I get an error when starting the shell:
/bin/pdksh: /home/leva/.profile[11]: no closing quote

I see that I must put a carriage return after that, but I don't know 
how. How can I put a CR after the control-A (if control-A is what I 
need at all)?

Daniel

-- 
LeVA



Reply to: