> I am beginner in using ksh93. So I tried to get the > look and feel I knew from bash. The following website > was useful: http://www.understudy.net/custom.html > I added to my /etc/ksh.kshrc the following text: > > export USERNAME=`whoami` > export HOSTNAME=`hostname` > # monochrome > #export PS1="'$USERNAME'@'$HOSTNAME':"'$PWD'" # " > # color > export > PS1="$'\E[31m''$USERNAME'$'\E[0m'@$'\E[1;31m''$HOSTNAM > E'$'\E[0m':"$'\E[1;34m''$PWD'" $'\E[0m'# " > > I think it would be useful for other beginners to put > some examples in that config-file instead of > searching the web... > > I was wondering about some strange behaviour after > setting the new prompt. Sometimes when using the > shell-history (by clicking arrow up key) the prompt > got overwritten by the command from history. That > means the command from history didn't come after the > prompt but overwrote it. So I was able to move the > cursor (with the arrow left key) in front of the > position where the end of the prompt should have > been. It looked like the prompt hadn't been set. But > in the next line (after pressing enter) the prompt > was there as desired. > > o.k. that's not a real big issue but confusing. [...]
Without actually trying it, this may or may not help. But I'd done a really tricky prompt once that included various escape sequences (such as to set the window title). I found I had to do all of those first, followed by a carriage return character and then the characters I wanted to see actually on the prompt. One problem is (at least with old ksh) that the inline editor modes simply count characters to know what column they're in; they know nothing of escape sequences. So the characters in an escape sequence are counted towards the total number of columns used by the prompt, but that probably doesn't match up with what you see on the screen. The carriage return character returns the shell's column count back to zero apparently, so that hid from its count all the stuff that came before the carriage return. Even then, there were some unusual cases where it could look a bit ugly on the screen, but mostly that trick took care of my problems doing what I wanted to with the prompt. -- This message posted from opensolaris.org