summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-08-14 10:38:50 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-08-14 10:38:50 -0400
commit2bf75c12593d8b1c70369c44a26dd478537c89e9 (patch)
tree7bd9fb72a9b0e5eced91d7224a1a5519629b94e4
parent6e9250619ca43588f10f1fca4420aaf80a6766ea (diff)
bash/rc.sh: clean up PS1
-rw-r--r--.config/bash/rc.sh14
1 files changed, 4 insertions, 10 deletions
diff --git a/.config/bash/rc.sh b/.config/bash/rc.sh
index 90e5b2d..dee42b4 100644
--- a/.config/bash/rc.sh
+++ b/.config/bash/rc.sh
@@ -5,11 +5,6 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
-# set variable identifying the chroot you work in (used in the prompt below)
-if [[ -z "$debian_chroot" ]] && [[ -r /etc/debian_chroot ]]; then
- debian_chroot="$(cat /etc/debian_chroot)"
-fi
-
# Why is this not on by default?
# "We have a cached value, but it isn't valid anymore. Should we trash it?"
# "Duh, yes!"
@@ -45,11 +40,10 @@ term-title() {
}
make_prompt() {
- local _CHROOT='${debian_chroot:+($debian_chroot)}'
- echo "${BOLD}${_CHROOT}${GREEN}\u@\h${RESET}${BOLD}${BLUE}:\w${RESET}"
+ echo "${BOLD}${GREEN}\u@\h${BLUE}:\w${RESET}"
}
-if [[ -x /usr/bin/tput ]] && tput setaf 1 >&/dev/null; then
+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.)
@@ -60,13 +54,13 @@ if [[ -x /usr/bin/tput ]] && tput setaf 1 >&/dev/null; then
BLUE="$(tput setaf 4)"
_STATUS="${BOLD}["
- _STATUS+="\$(v=\$?; if [[ \$v = 0 ]]; then c='${GREEN}'; else c='${RED}'; fi; printf %s%03i \$c \$v)"
+ _STATUS+="\$(v=\$?; [[ \$v = 0 ]] && c='${GREEN}' || c='${RED}'; printf %s%03i \$c \$v)"
_STATUS+="${RESET}${BOLD}]${RESET}"
else
_STATUS='[$?]'
fi
PS1="${_STATUS} $(make_prompt)"'\n\$ '
-unset RESET BOLD RED GREEN BLUE _STATUS use_color
+unset RESET BOLD RED GREEN BLUE _STATUS
PS1="$(term-title $(make_prompt))$PS1"
unset make_prompt