From 39df6caa0c102a28ce2c757049867040742eb56c Mon Sep 17 00:00:00 2001 From: Brett Bohnenkamper Date: Mon, 4 Nov 2013 01:19:05 -0600 Subject: [PATCH] Redirect STDERR to function to make errors prettier. Hopefully this actually works. Let me know if this fails miserably. --- screenfetch-dev | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/screenfetch-dev b/screenfetch-dev index 288ad1d..f3e1b3b 100755 --- a/screenfetch-dev +++ b/screenfetch-dev @@ -129,6 +129,9 @@ function verboseOut { function errorOut { printf "\033[1;37m[[ \033[1;31m! \033[1;37m]] \033[0m$1\n" } +function stderrOut { + while IFS='' read -r line; do printf "\033[1;37m[[ \033[1;31m! \033[1;37m]] \033[0m${line}\n"; done +} #################### @@ -3227,7 +3230,9 @@ for i in "${display[@]}"; do else if [[ "${display[*]}" =~ "$i" ]]; then if [[ "$errorSuppress" == "1" ]]; then detect${i} 2>/dev/null - else detect${i}; fi + else + exec 3> >(stderrOut) + detect${i} 2>&3; fi fi fi done