From 8fb66ffa6c2638708129c9ead5727c3b04a16e65 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 23 Feb 2021 17:27:53 +0100 Subject: [PATCH] bash: render prompt in the same color as separators --- files/bashrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/bashrc b/files/bashrc index 9b5a56a..ac78560 100644 --- a/files/bashrc +++ b/files/bashrc @@ -126,8 +126,8 @@ PS2="... " __ps1_set() { local exit=$? local prompt=">>>>>>>>>>" - local sep="$PS1_SEP_DARK$PS1_SEP" - [ "$BACKGROUND" = "light" ] && sep="$PS1_SEP_LIGHT$PS1_SEP" + local sep_color="$PS1_SEP_DARK" + [ "$BACKGROUND" = "light" ] && sep_color="$PS1_SEP_LIGHT" local ps=() [ $exit -ne 0 ] && ps+=("$PS1_EXIT$exit") @@ -139,8 +139,8 @@ __ps1_set() { local j="\j" && [ "${j@P}" -gt 0 ] && ps+=("$PS1_JOBS${j@P} bg") local extra="" - [ ${#ps[@]} -gt 1 ] && printf -v extra "$sep%s" "${ps[@]:1}" - PS1="${ps[0]}$extra$Reset ${prompt:0:$SHLVL} " + [ ${#ps[@]} -gt 1 ] && printf -v extra "$sep_color$PS1_SEP%s" "${ps[@]:1}" + PS1="${ps[0]}$extra$sep_color ${prompt:0:$SHLVL}$Reset " } &>/dev/null ##############################################################################