From 460ad15672e2ad6d56a601b951161ea3d9cb5f40 Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Sun, 23 Feb 2025 11:44:07 +0100 Subject: "Fix" color functions (proper syntax, switch to printf); fix git colour hints --- .bash/prompt.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.bash/prompt.bash b/.bash/prompt.bash index 178503a..4c4d068 100644 --- a/.bash/prompt.bash +++ b/.bash/prompt.bash @@ -4,14 +4,14 @@ # ----- PROMPT COLOURS ----- # fgcolor () { #echo "\\[\\033[38;5;"$1"m\\]" - echo "\033[38;5;${1}m" + printf '\033[38;5;%bm' "$1" } fgtcolor () { - echo "\033[38;2;$1;$2;$3m" + printf '\033[38;2;%b;%b;%bm' "$1" "$2" "$3" } bgcolor () { #echo "\\[\\033[48;5;"$1"m\\]" - echo "\033[48;5;${1}m" + printf '\033[48;5;%bm' "$1" } # This is Solaris bash compatible, so we cannot use + here for "at least once) but instead use the # stupid old asterisk (*). Well, here hetting "no digits" practically won't hurt. @@ -167,7 +167,7 @@ __prompt_command() { # of it. We don't like monoliths, we like modules; the latter is good practice. # also, see postexec --> one-time sourcing of git's prompt.sh if command -v __git_ps1 >/dev/null 2>&1;then - GIT_PS1_SHOWCOLORHINTS=1 + GIT_PS1_SHOWCOLORHINTS=1; export GIT_PS1_SHOWCOLORHINTS PS1+="$(__git_ps1 "%s ")" fi if [ "$EXIT" -eq 0 ];then -- cgit v1.2.3