summaryrefslogtreecommitdiff
path: root/.config/bash/rc.sh
diff options
context:
space:
mode:
Diffstat (limited to '.config/bash/rc.sh')
-rw-r--r--.config/bash/rc.sh16
1 files changed, 5 insertions, 11 deletions
diff --git a/.config/bash/rc.sh b/.config/bash/rc.sh
index faf8116..447796a 100644
--- a/.config/bash/rc.sh
+++ b/.config/bash/rc.sh
@@ -1,15 +1,10 @@
-# ~/.bashrc: executed by bash(1) for non-login shells.
+# ~/.bashrc: executed by bash(1) for interactive non-login shells.
# I include this file for all interactive invocations of bash(1), whether
# they are login shells or not.
# 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