aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/prompt.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-08-05 01:36:33 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-08-05 01:36:33 +1200
commit16d3fa382604f5457b750c52c97d3cf7c13a9e73 (patch)
tree6293656c3871b7c956421f066c794742e1544c91 /bash/bashrc.d/prompt.bash
parentImprove quoting around expansions (diff)
downloaddotfiles-16d3fa382604f5457b750c52c97d3cf7c13a9e73.tar.gz
dotfiles-16d3fa382604f5457b750c52c97d3cf7c13a9e73.zip
Don't check for tput
It's specified by POSIX, so probably overkill
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r--bash/bashrc.d/prompt.bash30
1 files changed, 11 insertions, 19 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index d222691b..598c1bd1 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -13,28 +13,20 @@ prompt() {
PROMPT_COMMAND='history -a'
PS1='\[\a\][\u@\h:\w]$(prompt return)$(prompt vcs)$(prompt jobs)\$'
- # If we have tput available, get some color codes
- if command -v tput &>/dev/null; then
+ # Check if we have non-bold bright green available
+ if [[ "$(tput colors)" -gt 8 ]]; then
+ color="$(tput setaf 10)"
- # Check if we have non-bold bright green available
- if [[ "$(tput colors)" -gt 8 ]]; then
- color="$(tput setaf 10)"
-
- # If we don't, fall back to the bold green
- else
- color="$(tput setaf 2)$(tput bold)"
- fi
-
- # Reset color and attributes
- reset="$(tput sgr0)"
-
- # String it all together
- PS1="\\[$color\\]$PS1\\[$reset\\] "
-
- # No colors, just add a space
+ # If we don't, fall back to the bold green
else
- PS1="$PS1 "
+ color="$(tput setaf 2)$(tput bold)"
fi
+
+ # Reset color and attributes
+ reset="$(tput sgr0)"
+
+ # String it all together
+ PS1="\\[$color\\]$PS1\\[$reset\\] "
;;
# Revert to simple inexpensive prompt