Updated to Fedora 39 today. Opened an xterm (then a console). Ctrl-C (termination) of a process results in the exit code (130) being displayed in red with the next command prompt. A little more experimentation showed that it was indeed the exit code (like trying to ls a non-existent file returned another code).
Perhaps for some folks this is a feature.
I removed this feature by editing /etc/profile.d/bash-color-prompt.sh as follows:
Original: PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_COLOR:-32}m\]\w\[\e[0;31m\]${?#0}\[\e[0m\]\$ '
Edited: PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_COLOR:-32}m\]\w\[\e[0m\]\$ '
The difference: \[\e[0;31m\]${?#0}
removed near end of PS1 definition.
Not claiming expert solution, but this worked for me.
Warning: do NOT try to modify /etc/bashrc
If someone has another more elegant solution, pray do tell.
Well I don’t love it either, but I put/left it in as “better than nothing”: failures are not always obvious.
If someone can make it work better that would be great.
Admittedly we have managed okay without this “feature” for a long time, so perhaps it is not strictly needed: you can also open a bug if you wish. It can be made optional I think: (edit) I went ahead and pushed an update to rawhide just now.
It has been possible from the beginning for users to have colored prompts, but does require editing of /etc/bashrc or ~/.bashrc to achieve that and setting the value of PS1 appropriately.
This change seems to make the colored prompts easier for the average user and simply needs to be tweaked to be suitable.
I might note that a color that works perfectly with a white background may not be suitable for a dark background, and vice-versa. Thus what works for a user who uses a dark theme might not work for those who use the light theme. Maybe that needs considered in setting the prompt colors as well.
It also has historically been appropriate for the user prompt to be one neutral color – green, blue, yellow – and if logged in as the root user the prompt has often been red to reflect the difference in potential risks and a reminder that the user is operating in a special mode.
I find that these are the settings that work best for me in both light and dark mode for both my regular user and for the root user.
Regular user
This is achieved in /etc/bashrc with:
(and works in both a standard terminal as well as a terminal window.)
# If id command returns zero, you are the root user.
if [ $(id -u) -eq 0 ];
then # you are root, set red colour prompt
PS1="\[\033[01;31m\][\u@\h\[\033[01;36m\] \W\[\033[01;31m\]]#\[\033[00m\] "
else # normal user
PS1="\[\033[01;32m\][\u@\h\[\033[01;33m\] \W\[\033[01;32m\]]\$\[\033[00m\] "
fi
Yes https://bodhi.fedoraproject.org/updates/FEDORA-2023-3e862eb724
is the F39 update which turns off the display of exit codes,
which should be in updates-testing tomorrow hopefully -
also with some new features
Notably the color of current dir can now be set separately.