diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-10-04 15:08:06 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-10-04 15:08:06 -0400 |
commit | 9685060a9222ae5bdc242c6366f4a074e5ad8589 (patch) | |
tree | 4fde5c1088d69d177852e9964acb38d546144a17 /.config/bash/rc.d/99_ps1.sh | |
parent | 4b151e74462b93b68ebbf90502de86b84917bd7c (diff) | |
parent | 795875623f9a9cd35374d2f0531182a267e81588 (diff) |
Merge branch 'master' into build64-par/master
# Conflicts:
# .config/emacs/init.el
Diffstat (limited to '.config/bash/rc.d/99_ps1.sh')
-rw-r--r-- | .config/bash/rc.d/99_ps1.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/bash/rc.d/99_ps1.sh b/.config/bash/rc.d/99_ps1.sh new file mode 100644 index 0000000..450e118 --- /dev/null +++ b/.config/bash/rc.d/99_ps1.sh @@ -0,0 +1,20 @@ +#!/hint/bash + +if tput setaf 1 &>/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + RESET="\\[$(tput sgr0)\\]" + BOLD="\\[$(tput bold)\\]" + RED="\\[$(tput setaf 1)\\]" + GREEN="\\[$(tput setaf 2)\\]" + BLUE="\\[$(tput setaf 4)\\]" + + STATUS="${BOLD}[" + STATUS+="\$(v=\$?; [[ \$v = 0 ]] && c='${GREEN}' || c='${RED}'; printf %s%03i \$c \$v)" + STATUS+="${RESET}${BOLD}]${RESET}" +else + STATUS='[$(printf "%03i" $?)]' +fi +PS1="${STATUS} ${BOLD}${GREEN}\u@\h${BLUE}:\w${RESET}${PS1_EXTRA}\\n\\$ " +unset RESET BOLD RED GREEN BLUE STATUS PS1_EXTRA |