From 5748a2178e3b0b324a5498c48071ac5db22049e0 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 22 Apr 2023 13:06:51 -0700 Subject: [PATCH] added rv tester --- functions.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/functions.sh b/functions.sh index ead52d9..72ce02c 100644 --- a/functions.sh +++ b/functions.sh @@ -101,9 +101,16 @@ treep() { # short for tree pager fi } -ts() { - ( # so we don't get stuck in that folder - cd "$HOME/Documents/GradSchool/Writing/0000-dissertation" - grep -R "$1" * - ) +function rv() { + RV=$? + if [[ $RV -eq 0 ]]; then + COLOR='2' + elif [[ $RV -eq 1 ]]; then + COLOR='3' + else + COLOR='1' + fi + printf '\e[4%dm' $COLOR + printf ' RV=%d \e[0m\n' $RV >&2 } +