I use a custom color prompt for my bash shell. I had to use different methods in my Fedora and Debian qubes to get the prompt I wanted. It's a little tricky because you have to check and see how the system files setup the $PS1 file. Because I wanted the same definition in each of my qubes I ended up creating a /etc/profile.d/custom.sh file to define the prompt in Fedora templates to set the prompt in each appVM based on that template. The code based on some adapted Debian or Ubuntu code. There is also a bunch of code to setup definitions for colors and other terminal escape sequences.
My custom.sh produces prompt like:
[user@docker-fed-37:2 Fri 2023-05-05 17:35 GMT /etc/profile.d]$
where
user@docker-fed-37 is green
/etc/profile.d is bright_blue
the :2 represents the terminal number where numbering starts with :0
===custom.sh===
# User specific aliases and functions
term-control-colors () {
#
https://mywiki.wooledge.org/BashFAQ/037# Variables for terminal requests.
[[ -t 2 ]] && {
alt=$( tput smcup || tput ti ) # Start alt display
ealt=$( tput rmcup || tput te ) # End alt display
hide=$( tput civis || tput vi ) # Hide cursor
show=$( tput cnorm || tput ve ) # Show cursor
save=$( tput sc ) # Save cursor
load=$( tput rc ) # Load cursor
bold=$( tput bold || tput md ) # Start bold
stout=$( tput smso || tput so ) # Start stand-out
estout=$( tput rmso || tput se ) # End stand-out
under=$( tput smul || tput us ) # Start underline
eunder=$( tput rmul || tput ue ) # End underline
reset=$( tput sgr0 || tput me ) # Reset cursor
blink=$( tput blink || tput mb ) # Start blinking
italic=$( tput sitm || tput ZH ) # Start italic
eitalic=$( tput ritm || tput ZR ) # End italic
[[ $TERM != *-m ]] && {
red=$( tput setaf 1|| tput AF 1 )
green=$( tput setaf 2|| tput AF 2 )
yellow=$( tput setaf 3|| tput AF 3 )
blue=$( tput setaf 4|| tput AF 4 )
bright_blue=$( tput setaf 12|| tput AF 12 )
magenta=$( tput setaf 5|| tput AF 5 )
cyan=$( tput setaf 6|| tput AF 6 )
# for broken termcap databases with 16 ANSI colors
# blue=$'\e[0;34m'
# green=$'\e[0;32m'
# white=$'\e[0;37m'
}
white=$( tput setaf 7|| tput AF 7 )
default=$( tput op )
eed=$( tput ed || tput cd ) # Erase to end of display
eel=$( tput el || tput ce ) # Erase to end of line
ebl=$( tput el1 || tput cb ) # Erase to beginning of line
ewl=$eel$ebl # Erase whole line
draw=$( tput -S <<< ' enacs
smacs
acsc
rmacs' || { \
tput eA; tput as;
tput ac; tput ae; } ) # Drawing characters
back=$'\b'
} 2>/dev/null ||:
}
# set local definitions
term-control-colors
# my_blue=$'\e[0;34m'
# my_green=$'\e[0;32m'
# my_white=$'\e[0;37m'
# my_reset=$'\e[00m'