From 17afda4f227fbb8c07269ef8c96cc7931cf6f02f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 21 Dec 2016 17:10:27 +1300 Subject: Use clearer logic for prompt color setting --- bash/bashrc.d/prompt.bash | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bash') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index ed09afdd..776ac8a6 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -52,19 +52,18 @@ prompt() { # Check if we have non-bold bright green available if ((colors >= 16)) ; then format=$( - : "${PROMPT_COLOR:=10}" - tput setaf "$PROMPT_COLOR" || - tput setaf "$PROMPT_COLOR" 0 0 || - tput AF "$PROMPT_COLOR" || - tput AF "$PROMPT_COLOR" 0 0 + pc=${PROMPT_COLOR:-10} + tput setaf "$pc" || + tput setaf "$pc" 0 0 || + tput AF "$pc" || + tput AF "$pc" 0 0 ) # If we have only eight colors, use bold green elif ((colors >= 8)) ; then format=$( - : "${PROMPT_COLOR:=2}" - tput setaf "$PROMPT_COLOR" || - tput AF "$PROMPT_COLOR" + pc=${PROMPT_COLOR:-2} + tput setaf "$pc" || tput AF "$pc" tput bold || tput md ) -- cgit v1.2.3