From f0d08ebd2f6b32e879efda3c496d24503919e0e9 Mon Sep 17 00:00:00 2001 From: Alex Ray Date: Fri, 8 Mar 2013 15:15:06 -0800 Subject: [PATCH] pez: colored SUCCESS/FAILURE indicator pez is a new bash function that can be prepended to existing functions or commands to clearly show a colored exit status. Example: $ pez mmm frameworks/base/etc will print all the usual output, and at the end either a green "SUCCESS" line or a red "FAILURE" line. Change-Id: I7e369b0280d6ece16fb0be1895278c26922491fe --- envsetup.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/envsetup.sh b/envsetup.sh index b118e5aaf..0ab15ae26 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -1236,6 +1236,19 @@ function set_java_home() { fi } +# Print colored exit condition +function pez { + $@ + retval=$? + if [ $retval -ne 0 ] + then + echo -e "\e[0;31mFAILURE\e[00m" + else + echo -e "\e[0;32mSUCCESS\e[00m" + fi + return $retval +} + if [ "x$SHELL" != "x/bin/bash" ]; then case `ps -o command -p $$` in *bash*)