summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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