diff options
author | xengineering <me@xengineering.eu> | 2021-09-03 12:55:35 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2021-09-03 12:55:35 +0200 |
commit | 1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45 (patch) | |
tree | 4b8dbd86066b2f9556586b6b9210694a3b4562c1 | |
parent | 4ccd09685efe49c7ea213c5af3138b431eff1ae3 (diff) | |
download | dotfiles-1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45.tar dotfiles-1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45.tar.zst dotfiles-1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45.zip |
Implement fancy Bash Prompt
-rw-r--r-- | .bashrc | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -2,6 +2,9 @@ # ~/.bashrc # +# vim: shiftwidth=4 tabstop=4 expandtab + + # If not running interactively, don't do anything [[ $- != *i* ]] && return @@ -30,5 +33,16 @@ parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } -PS1='[\u@\h$(parse_git_branch) \W]\$ ' +get_nonzero_retcode() { + retcode=$? + if [ "${retcode}" -eq "0" ] + then + true + else + echo " ${retcode} " + fi +} + +PS1='[\e[31m$(get_nonzero_retcode)\e[0m\e[32;1m$(date +"%H:%M:%S")\e[0m \e[35;1m\u@\h\e[0m\e[33;1m$(parse_git_branch)\e[0m \e[36;1m\W\e[0m] +$ ' |