shell输出加颜色

shell输出加颜色

#cat  a.sh
#!/bin/sh
blue=`tput setaf 4`
reset=`tput sgr0`
echo "${blue}[INFORMATION]${reset}"
#!/bin/sh
lib_dir=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
LOG_format="/var/log/os_stress.log"
LOG_real="/var/log/os_real_stress.log"

  #local level="$(echo $1 | tr 'a-z' 'A-Z')"
mesg(){
  local GROUP=$1
  local IP=$2
  local KEY=$3
  local VALUE=$4
  local MEASURE=$5

  echo -e "\033[32m$(date "+%F %H:%M:%S")\033[0m,$GROUP,$IP,$KEY,$VALUE,$MEASURE"
  return 0
}
mesg $1 $2 $3 $4 $5
posted @ 2016-12-09 14:00  苏小北1024  阅读(354)  评论(0编辑  收藏  举报