diff options
author | mail_redacted_for_web | 2025-02-23 11:44:07 +0100 |
---|---|---|
committer | mail_redacted_for_web | 2025-02-23 11:44:07 +0100 |
commit | 460ad15672e2ad6d56a601b951161ea3d9cb5f40 (patch) | |
tree | 41152f84dc021fb7f489e29bd246418da8de3746 | |
parent | 6d614e42f754576d925a6c842dcd848f3e50900f (diff) | |
download | dotfiles-460ad15672e2ad6d56a601b951161ea3d9cb5f40.tar.bz2 |
"Fix" color functions (proper syntax, switch to printf); fix git colour hints
-rw-r--r-- | .bash/prompt.bash | 8 |
1 files 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 |