From c844e21b7b941cd51d0c2cae353b2f083eb83c35 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Wed, 21 Apr 2021 19:36:08 +0200 Subject: [PATCH] Added status code to prompt --- .bashrc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index a612aa2..e5463b5 100644 --- a/.bashrc +++ b/.bashrc @@ -10,8 +10,16 @@ export EDITOR=nvim export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH" +# =====FUNCTIONS===== +function print_status() { + if [[ $1 -ne 0 ]]; then + echo "$1 " + fi +} + + # =====PROMPT===== -PS1=" \e[1;33m\w\e[m \n \e[1;36m>\e[m " +PS1=" \e[1;31m\$(print_status \$?)\e[1;33m\w\e[m \n \e[1;36m>\e[m " # =====EXTERNAL SCRIPTS=====