Multiline PS1 prompt

kshprompt

Is the a way to specify a multi line prompt in Korn shell?

I am planning to swhitch from bash to ksh. In bash I have a very simplistic prompt, but it is 2 line prompt. I hate when input position changes depending on directory depth. My PS1 in bash is:

PS1='$(echo $?): \w\n>> '

Which results in prompt like:

0: /var/log
>> _

Best Answer

Just put an embedded newline inside the string:

PS1='$(echo $?): $PWD
>> '
Related Question