OSDN Git Service

[update] : update echo colors
authormk-linux419 <m.k419sabuaka@gmail.com>
Thu, 13 Aug 2020 06:31:23 +0000 (15:31 +0900)
committermk-linux419 <m.k419sabuaka@gmail.com>
Thu, 13 Aug 2020 07:19:55 +0000 (16:19 +0900)
echo_color

index 6a3fee3..696f4dc 100755 (executable)
@@ -4,6 +4,7 @@ while getopts 't:b:d:' arg; do
         t) textcolor="${OPTARG}" ;;
         b) backcolor="${OPTARG}" ;;
         d) deco="${OPTARG}" ;;
+        *) echo "Invalid argument '${OPTARG}'" ;;
     esac
 done
 
@@ -15,7 +16,8 @@ if [[ -n "${deco}" ]]; then
         1) decotypes="bold" ;;
         4) decotypes="smul" ;;
         5) decotypes="blink" ;;
+        *) echo "Invalid argument '${deco}'" ;;
     esac
 fi
 
-echo "$([[ -n "${textcolor}" ]] && tput setaf ${textcolor})$([[ -n "${backcolor}" ]] && tput setab ${backcolor})$([[ -n "${decotypes}" ]] && tput ${decotypes})${@}$(tput sgr0)"
\ No newline at end of file
+echo "$([[ -n "${textcolor}" ]] && tput setaf "${textcolor}")$([[ -n "${backcolor}" ]] && tput setab "${backcolor}")$([[ -n "${decotypes}" ]] && tput "${decotypes}")${*}$(tput sgr0)"
\ No newline at end of file