From de8826bb2f2384a9ea26a85581f36b7ca08ec0d6 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Mon, 14 Feb 2022 14:34:23 +0000 Subject: [PATCH] Color output only for tty --- check_modules.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/check_modules.sh b/check_modules.sh index 5d34127..09d2536 100755 --- a/check_modules.sh +++ b/check_modules.sh @@ -32,11 +32,14 @@ do ;; esac done -# definitions for esear color output to display -Color_Off='\e[0m' # Text Reset -IGreen='\e[0;92m' # Intense Green -IRed='\e[0;91m' # Intense Red -IMagenta='\e[0;95m' # magenta + +# definitions for color output if outputting to tty +if [ -t 1 ] ; then + Color_Off='\e[0m' # Text Reset + IGreen='\e[0;92m' # Intense Green + IRed='\e[0;91m' # Intense Red + IMagenta='\e[0;95m' # magenta +fi # intermediate files, logfiles LOGDIR=${LOGDIR:=$PWD}