summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohannst <stoelp@eit.uni-kl.de>2018-01-19 00:02:17 +0100
committerjohannst <stoelp@eit.uni-kl.de>2018-01-19 00:02:17 +0100
commit267cc95265c7a49084a24147e968c7dc18834992 (patch)
tree91647e1d00abc7c3d933f1fb13eb90fe6c3961e2
parentd7fd15790ca16d1a5d34bc830748ad0d91ab3ba4 (diff)
downloaddotfiles-267cc95265c7a49084a24147e968c7dc18834992.tar.gz
dotfiles-267cc95265c7a49084a24147e968c7dc18834992.zip
bashrc need to inline return_value_formater to escape color codes accordingly
-rw-r--r--bashrc6
1 files changed, 3 insertions, 3 deletions
diff --git a/bashrc b/bashrc
index e7aa2d1..808202d 100644
--- a/bashrc
+++ b/bashrc
@@ -92,9 +92,9 @@ function return_val_formater() {
local ret=$1
local ret_str
if [[ $ret == 0 ]]; then
- ret_str="${BCol_BrightGreen}";
+ ret_str='${BCol_BrightGreen}';
else
- ret_str="${BCol_BrightRed}";
+ ret_str='${BCol_BrightRed}';
fi
ret_str+="$ret${BCol_NoColor}"
echo -e "$ret_str";
@@ -107,7 +107,7 @@ function pwd_formater() {
}
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}\][\$(return_val_formater \$?)\[${BCol_NoColor}\]] \$>\[${BCol_NoColor}\] "
+\[${BCol_NoColor}\][\$(ret=\$?; if [[ \$ret == 0 ]]; then echo \"\[${BCol_BrightGreen}\]\$ret\"; else echo \"\[${BCol_BrightRed}\]\$ret\"; fi)\[${BCol_NoColor}\]] \$> "
export PROMPT_COMMAND="echo -e ''"