only show error code if PROMPT_ERROR set

This commit is contained in:
Jens Petersen 2023-11-09 17:45:14 +08:00
parent a61100d98d
commit 0643778d98
2 changed files with 6 additions and 3 deletions

View File

@ -16,5 +16,5 @@ if [ "$PS1" = "[\u@\h \W]\\$ " -a "${TERM: -5}" = "color" -o -n "${prompt_color_
# PROMPT_COLOR='1;33;44' # bold yellow on blue
# PROMPT_COLOR='1;32' # bold green
# PROMPT_COLOR='' # unset defaults to green
PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_COLOR:-32}m\]\w\[\e[0;31m\]${?#0}\[\e[0m\]\$ '
PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_COLOR:-32}m\]\w\[\e[0;31m\]${PROMPT_ERROR:+${?#0}}\[\e[0m\]\$ '
fi

View File

@ -1,6 +1,6 @@
Name: shell-color-prompt
Version: 0.1
Release: 6%{?dist}
Version: 0.1.1
Release: 1%{?dist}
Summary: Color prompt for bash shell
License: GPL-2.0-or-later
@ -41,6 +41,9 @@ install -m 644 -D -t %{buildroot}%{profiledir} bash-color-prompt.sh
%changelog
* Thu Nov 9 2023 Jens Petersen <petersen@redhat.com> - 0.1.1-1
- only show error code if PROMPT_ERROR set
* Tue Aug 15 2023 Jens Petersen <petersen@redhat.com> - 0.1-6
- rename source package to shell-color-prompt