From 7ae2e0b9efb40ba6d2430d9076f215869d2df4c0 Mon Sep 17 00:00:00 2001 From: spacewander Date: Thu, 8 Oct 2015 10:24:31 +0800 Subject: [PATCH] git-scp: use portable terminal escape sequences --- bin/git-scp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/git-scp b/bin/git-scp index 7481b60..e12c3c9 100755 --- a/bin/git-scp +++ b/bin/git-scp @@ -1,10 +1,10 @@ #!/usr/bin/env bash -COLOR_RED() { echo -en "\033[31m"; } -COLOR_GREEN() { echo -en "\033[32m"; } -COLOR_YELLOW(){ echo -en "\033[33m"; } -COLOR_BLUE() { echo -en "\033[34m"; } -COLOR_RESET() { echo -en "\033[0m"; } +COLOR_RED() { test -t 1 && echo -n "$(tput setaf 1)"; } +COLOR_GREEN() { test -t 1 && echo -n "$(tput setaf 2)"; } +COLOR_YELLOW(){ test -t 1 && echo -n "$(tput setaf 3)"; } +COLOR_BLUE() { test -t 1 && echo -n "$(tput setaf 4)"; } +COLOR_RESET() { test -t 1 && echo -n "$(tput sgr 0)"; } function _test_git_scp() {