# If you wish to prevent non KSH shells from running this # [ -z "$KSH_VERSION" ] && return # Restrict this to KSH only if ! [ -z "$KSH_VERSION" ] ; then precmd() { typeset e=$? (( e )) && print -n "$e|" } set_ps1() { PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${USER_C}${USER:=$(id -un)}@$(hostname)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} ${END_P} ' export PS1; } set_root_ps1() { PS1='$(precmd)${BG}${ACCENT_C}${ACCENT_P}${HOST_C}$(hostname)${ACCENT_C}${ACCENT_P} ${ACCENT_P}${PATH_C}${PWD:-?}${ACCENT_C}${ACCENT_P}${END_C} ${END_P} ' export PS1; } # RED: 31, GREEN: 32, YELLOW: 33, BLUE: 34, MAGENTA: 35, CYAN: 36, WHITE: 37, GREY 38. and No color which is 0. set_prompt() { if [ `id -u` -eq 0 ] ; then # Previously # Red for root, and no username # PS1="$(hostname) \$PWD echo $TERM | grep "256color$" > /dev/null 2>&1 if [ $? -eq 0 ] ; then BG="" ACCENT_C="" ACCENT_P="|" HOST_C="" PATH_C="" END_C="" set_root_ps1 END_P="#" else BG="" ACCENT_C="" ACCENT_P="|" HOST_C="" PATH_C="" END_P="#" fi set_root_ps1 else # Previously # PS1="${USER:=$(id -un)}@$(hostname) \$PWD echo $TERM | grep "256color$" > /dev/null 2>&1 if [ $? -eq 0 ] ; then BG="" ACCENT_C="" ACCENT_P="|" USER_C="" PATH_C="" END_C="" END_P="%" else BG="" ACCENT_C="" ACCENT_P="|" USER_C="" PATH_C="" END_C="" END_P="$" fi set_ps1 fi } set_basic_prompt() { if [ $(id -u) -eq 0 ] ; then PS1='$(precmd)'"${USER:=$(id -un)}@$(hostname) \$PWD # " else PS1='$(precmd)'"${USER:=$(id -un)}@$(hostname) \$PWD $ " fi export PS1; } fi