ksh/.kshrc.d/99-prompt.ksh (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
set -o emacs lf=' ' cr=$(print -n '\r') esc=$(print -n '\033') ps1flag=$(print -n '\001') red="$esc[31m" grn="$esc[32m" ylw="$esc[33m" cyn="$esc[36m" blu="$esc[34m" prp="$esc[35m" bprp="$esc[35;1m" gry="$esc[94m" rst="$esc[0m" git_status() { if [[ -d .git ]]; then git_status=$(git status 2>/dev/null) on_branch= fi } # first, set the rootornot part if [[ $(id -u) = 0 ]]; then PS1="$ps1flag$red$ps1flag#$ps1flag$rst$ps1flag" else PS1= fi # then, combine it all PS1="$ps1flag$cr $ps1flag$cyn$ps1flag\$PWD$ps1flag$rst$ps1flag ▲$PS1 " PS2="> " |