From 047de95bc04d5a6f452310e055d44a615446b966 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Mon, 9 Jul 2012 06:18:44 -0500 Subject: [PATCH] sh/ansi: add additional ansi definitions --- lib/sh/ansi.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/sh/ansi.sh b/lib/sh/ansi.sh index 53a757c..acaf50a 100644 --- a/lib/sh/ansi.sh +++ b/lib/sh/ansi.sh @@ -6,7 +6,17 @@ then # ANSI formats e="$(printf "\033")" - a_normal="$e[0m" + + # ANSI styles + a_bright="$e[1m" + a_dim="$e[2m" + a_italic="$e[3m" # Probably won't work + a_underline="$e[4m" # Probably won't work + a_blink="$e[5m" # Annoying; probably won't work + a_flash="$e[6m" # Probably won't work + a_inverse="$e[7m" + a_conceal="$e[8m" # Probably won't work + a_strike="$e[9m" # Probably won't work # ANSI colors a_red="$e[1;31m" @@ -36,7 +46,14 @@ then a_bgray="$e[47m" a_bblack="$e[40m" + # Normal is at the bottom, otherwise debugging via 'sh -x' is difficult + a_normal="$e[0m" + a() { - eval "echo \${a_$1}" + while [ "${1}" ] + do + eval "echo \${a_$1}" + shift + done } fi -- 2.42.0