So I am a newbie in using Linux and I am following courses and blog posts related to linux to learn more and more about it. As I was searching about Linux Bashrc, what it is and how to use it, I came across a piece of code to change the color of the shell when a command fails to work properly. I read about the linux bashrc in the linked article, but my problem is the following lines.
This prompt changes the color if your last command failed to run successfully, but it also shortens long paths and contains the bash history number of each command for easy retrieval. This can be very helpful and efficient.
PROMPT_COMMAND='PS1="\[\033[0;33m\][\!]\'if [[ \$? = "0" ]];
then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]";
fi\'[\u.\h: \'if [[ \pwd|WC -c|tr -d " "' > 18 ]]; then echo
"\\W"; else echo "\\w"; fi\']\$\[\033[0m\] "; echo -ne
"\033]0; hostname -s':'pwed'\007"'
I write exactly as this code says but still I get nothing, what could be the problem? I'd appreciate it if anyone could help me.