Translate

Image of Linux Kernel Development (3rd Edition)
Image of Modern Operating Systems (3rd Edition)
Image of Android Wireless Application Development
Image of Operating System Concepts

Bash-like Customizable Prompt in Korn Shell

Bash has built-in support for extensive PS1 prompt customization using parameterless macros. As a result many people customize their shell prompts. There is no equivalent built-in support for PS1 customization in ksh93 but such support can easily be added using a discipline function. This post provides an example of such a PS1 discipline function. Add the following discipline function to your ~/.kshrc and ensure that ~/.kshrc is included in your ~/.profile shell startup script which, by the way, only gets executed at login if ksh93 is your default shell. function PS1.set { typeset prefix remaining=${.sh.value} var= n= k= set -A