From 5d2c1f68eb91321dc234b40c3809201a468e4931 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Fri, 7 Jun 2024 21:06:17 +0800 Subject: [PATCH] test for BASH_VERSION to avoid running for other shells (#2279643) --- bash-color-prompt.sh | 2 +- shell-color-prompt.spec | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bash-color-prompt.sh b/bash-color-prompt.sh index 826da4e..195df2d 100644 --- a/bash-color-prompt.sh +++ b/bash-color-prompt.sh @@ -4,7 +4,7 @@ # PROMPT_DIRTRIM=3 # only set for color terminals and if PS1 unchanged from bash or fedora defaults -if [ '(' "$PS1" = "[\u@\h \W]\\$ " -o "$PS1" = "\\s-\\v\\\$ " ')' -a '(' "${TERM: -5}" = "color" -o "${TERM}" = "linux" ')' -o -n "${bash_prompt_color_force}" ]; then +if [ -n "${BASH_VERSION}" -a '(' "$PS1" = "[\u@\h \W]\\$ " -o "$PS1" = "\\s-\\v\\\$ " ')' -a '(' "${TERM: -5}" = "color" -o "${TERM}" = "linux" ')' -o -n "${bash_prompt_color_force}" ]; then PROMPT_COLOR="${PROMPT_COLOR:-32}" PROMPT_USERHOST="${PROMPT_USERHOST:-\u@\h}" diff --git a/shell-color-prompt.spec b/shell-color-prompt.spec index ecb5484..049500e 100644 --- a/shell-color-prompt.spec +++ b/shell-color-prompt.spec @@ -1,5 +1,5 @@ Name: shell-color-prompt -Version: 0.4.1 +Version: 0.4.2 Release: 1%{?dist} Summary: Color prompt for bash shell @@ -41,6 +41,12 @@ install -m 644 -D -t %{buildroot}%{profiledir} bash-color-prompt.sh %changelog +* Fri Jun 7 2024 Jens Petersen - 0.4.2-1 +- test for BASH_VERSION to avoid running for other shells + (#2279643, Nathan Grennan) +- fix condition regression introduced by previous linux console change +- rename prompt_color_force variable to bash_prompt_color_force + * Thu Jan 25 2024 Jens Petersen - 0.4.1-1 - also enable for Linux console (TERM=linux)