#!/usr/bin/env bash while getopts 't:b:d:' arg; do case ${arg} in t) textcolor="${OPTARG}" ;; b) backcolor="${OPTARG}" ;; d) deco="${OPTARG}" ;; esac done shift $((OPTIND - 1)) if [[ -n "${deco}" ]]; then case ${deco} in 0) decotypes="sgr 0" ;; 1) decotypes="bold" ;; 4) decotypes="smul" ;; 5) decotypes="blink" ;; esac fi echo "$([[ -n "${textcolor}" ]] && tput setaf ${textcolor})$([[ -n "${backcolor}" ]] && tput setab ${backcolor})$([[ -n "${decotypes}" ]] && tput ${decotypes})${@}$(tput sgr0)"