From 08ee072f11be76d7b9268d836c0912cd7c369a03 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 6 Sep 2016 19:37:41 +0800 Subject: [PATCH] minor, fix color --- acme.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/acme.sh b/acme.sh index d9e0a12..c68215a 100755 --- a/acme.sh +++ b/acme.sh @@ -47,24 +47,27 @@ if [ -z "$AGREEMENT" ] ; then AGREEMENT="$DEFAULT_AGREEMENT" fi - +__INTERACTIVE="" +if [ -t 1 ] ; then + __INTERACTIVE="1" +fi __green() { - if [ -t 1 ] ; then + if [ "$__INTERACTIVE" ] ; then printf '\033[1;31;32m' fi printf -- "$1" - if [ -t 1 ] ; then + if [ "$__INTERACTIVE" ] ; then printf '\033[0m' fi } __red() { - if [ -t 1 ] ; then + if [ "$__INTERACTIVE" ] ; then printf '\033[1;31;40m' fi printf -- "$1" - if [ -t 1 ] ; then + if [ "$__INTERACTIVE" ] ; then printf '\033[0m' fi }