summaryrefslogtreecommitdiff
path: root/bashrc
diff options
context:
space:
mode:
authorjohannst <stoelp@eit.uni-kl.de>2018-01-18 00:38:29 +0100
committerjohannst <stoelp@eit.uni-kl.de>2018-01-18 00:38:29 +0100
commitfdc23dc5de4835a4e3a927db730a28f340e31f90 (patch)
treef8529f4dbbb965007544766c43eb2ca599a73f63 /bashrc
parent0e4c32bc4e931c680b0933286f8b5c506f98f1c2 (diff)
downloaddotfiles-fdc23dc5de4835a4e3a927db730a28f340e31f90.tar.gz
dotfiles-fdc23dc5de4835a4e3a927db730a28f340e31f90.zip
bashrc added pwd/return_value formater for new PS1
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc26
1 files changed, 24 insertions, 2 deletions
diff --git a/bashrc b/bashrc
index 52385f4..64b580a 100644
--- a/bashrc
+++ b/bashrc
@@ -83,11 +83,33 @@ BCol_BrightGreen='\e[38;5;40m'
#export PS1="[\s] \[${BCol_DarkRed}\]::\[${BCol_DarkOrange}\]\u\[${BCol_DarkRed}\]::\[${BCol_LightOrange}\]\H\[${BCol_LightGray}\]:$(tty) - \[${BCol_Yellow}\]\t\[${BCol_LightGray}\] - \[${BCol_LightBlue}\]\w\n\[${BCol_NoColor}\][\[${BCol_YellowOrange}\]\${?}\[${BCol_NoColor}\]] \[${BCol_BlueGray}\]>>\[${BCol_NoColor}\] "
# \s shell type
-export PS1="\[${BCol_BrightRed}\]::\[${BCol_MediumGray}\]\u\[${BCol_BrightRed}\]::\[${BCol_LightGray}\]\H\[${BCol_BrightRed}\]:\[${BCol_DarkGray}\]$(tty) \[${BCol_LightGray}\] - \[${BCol_DarkBlue}\]\w\n\
-\[${BCol_NoColor}\][\[${BCol_BrightGreen}\]\${?}\[${BCol_NoColor}\]] \$>\[${BCol_NoColor}\] "
+#export PS1="\[${BCol_BrightRed}\]::\[${BCol_MediumGray}\]\u\[${BCol_BrightRed}\]::\[${BCol_LightGray}\]\H\[${BCol_BrightRed}\]:\[${BCol_DarkGray}\]$(tty) \[${BCol_LightGray}\] - \[${BCol_DarkBlue}\]\w\n\
+#\[${BCol_NoColor}\][\[${BCol_BrightGreen}\]\${?}\[${BCol_NoColor}\]] \$>\[${BCol_NoColor}\] "
+
#✓
#✗
+function return_val_formater() {
+ local ret=$1
+ local ret_str
+ if [[ $ret == 0 ]]; then
+ ret_str="${BCol_BrightGreen}";
+ else
+ ret_str="${BCol_BrightRed}";
+ fi
+ ret_str+="$ret${BCol_NoColor}"
+ echo -e "$ret_str";
+}
+
+function pwd_formater() {
+ local pwd=$1
+ local ret_str=$(echo $pwd | sed "s#[^A-Za-z]\+#\\${BCol_BrightRed}/\\${BCol_DarkBlue}#")
+ echo -e "$ret_str";
+}
+
+export PS1="\[${BCol_BrightRed}\]::\[${BCol_MediumGray}\]\u\[${BCol_BrightRed}\]::\[${BCol_LightGray}\]\H\[${BCol_BrightRed}\]:\[${BCol_DarkGray}\]$(tty) \[${BCol_LightGray}\] - \[${BCol_DarkBlue}\]\$(pwd_formater \w)\n\
+\[${BCol_NoColor}\][\$(return_val_formater \$?)\[${BCol_NoColor}\]] \$>\[${BCol_NoColor}\] "
+export PROMPT_COMMAND="echo -e ''"
#}}}
#{{{ ls colors