From 19fce2aa8c0e30b8fe5e8287f35bd4c2a692d55a Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 28 Apr 2015 11:35:08 +0100 Subject: [PATCH] Only output colour escapes when attached to a tty --- test/config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/config.sh b/test/config.sh index 4076845c..5345ed05 100644 --- a/test/config.sh +++ b/test/config.sh @@ -36,12 +36,12 @@ remote() { } colourise() { - echo -ne '\e['$1'm' + [ -t 0 ] && echo -ne '\e['$1'm' || true shift # It's important that we don't do this in a subshell, as some # commands we execute need to modify global state "$@" - echo -ne '\e[0m' + [ -t 0 ] && echo -ne '\e[0m' || true } whitely() {