Conditional color based on last exit code
jxu opened this issue · 1 comments
jxu commented
Scriptim commented
That is not a built-in feature of the Bash prompt as far as I know. So you'd have to write a custom function (e.g., in your .bashrc or inline) that outputs the colored prompt symbol. Then you can use the Command element in the prompt generator and configure it to call the function.
For instance, you could use the following command:
if [[ "$?" == "0" ]]; then echo -e "\e[32m✓\e[0m"; else echo -e "\e[31m✘\e[0m"; fi