summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2021-09-03 12:55:35 +0200
committerxengineering <me@xengineering.eu>2021-09-03 12:55:35 +0200
commit1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45 (patch)
tree4b8dbd86066b2f9556586b6b9210694a3b4562c1
parent4ccd09685efe49c7ea213c5af3138b431eff1ae3 (diff)
downloaddotfiles-1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45.tar
dotfiles-1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45.tar.zst
dotfiles-1ea8c35b6fe25bd3b717ceaeac34a9eb21608a45.zip
Implement fancy Bash Prompt
-rw-r--r--.bashrc16
1 files changed, 15 insertions, 1 deletions
diff --git a/.bashrc b/.bashrc
index ecc83ae..910e58e 100644
--- a/.bashrc
+++ b/.bashrc
@@ -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]
+$ '