OSDN Git Service

[fix] : efi cp error
[alterlinux/LUBS.git] / echo_color
index 6a3fee3..79ff33b 100755 (executable)
@@ -1,9 +1,21 @@
 #!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-3.0
+#
+# mk-linux419
+# Twitter: @fascoder_4
+# Email  : m.k419sabuaka@gmail.com
+#
+# (c) 2019-2020 Fascode Network.
+#
+# echo_color
+#
+
 while getopts 't:b:d:' arg; do
     case ${arg} in
         t) textcolor="${OPTARG}" ;;
         b) backcolor="${OPTARG}" ;;
         d) deco="${OPTARG}" ;;
+        *) echo "Invalid argument '${OPTARG}'" ;;
     esac
 done
 
@@ -15,7 +27,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