also check for bash default prompt for login shell by Sam Morris (#2248853)

This commit is contained in:
Jens Petersen 2023-11-10 15:08:18 +08:00
parent 88fb2b60ee
commit 75f56530c3
3 changed files with 5 additions and 4 deletions

View File

@ -11,7 +11,7 @@ which otherwise defaults to `PROMPT_COLOR`.
Set `prompt_color_force` (before source'ing) to force usage/updating of color PS1:
by default it is only setup cautiously if `$TERM` ends in "color"
*and* PS1 is the fedora default.
*and* PS1 is the fedora or bash default.
Also you can set `PROMPT_ERROR` if you want to append red error exit code to the prompt.

View File

@ -1,10 +1,10 @@
## to shorten \w dirpath:
## to truncate \w dirpath set:
# PROMPT_DIRTRIM=4
# See <https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters> for ANSI codes
# only set for color terminals and if PS1 unchanged
if [ "$PS1" = "[\u@\h \W]\\$ " -a "${TERM: -5}" = "color" -o -n "${prompt_color_force}" ]; then
# 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 -n "${prompt_color_force}" ]; then
# examples:
# PROMPT_COLOR=0 # disable colors/attribs
# PROMPT_COLOR=1 # bold prompt

View File

@ -43,6 +43,7 @@ install -m 644 -D -t %{buildroot}%{profiledir} bash-color-prompt.sh
%changelog
* Fri Nov 10 2023 Jens Petersen <petersen@redhat.com> - 0.2-1
- add PROMPT_DIR_COLOR to change the dir color (Thomas Steenholdt, #2239152)
- also check for bash default prompt for login shell (Sam Morris, #2248853)
* Thu Nov 9 2023 Jens Petersen <petersen@redhat.com> - 0.1.1-1
- only show error code if PROMPT_ERROR set