1 #!/bin/bash 2 3 NORMAL=$(tput sgr0) 4 GREEN=$(tput setaf 2; tput bold) 5 YELLOW=$(tput setaf 3) 6 RED=$(tput setaf 1) 7 8 function red() 9 { 10 echo -e "$RED$1$NORMAL" 11 } 12 13 function green() 14 { 15 echo -e "$GREEN$1$NORMAL" 16 } 17 18 function yellow() 19 { 20 echo -e "$YELLOW$1$NORMAL" 21 } 22 23 #to print success 24 green "Task has been completed" 25 26 #to print error 27 red "The configuration file does not exist" 28 29 #to print warning 30 yellow "You have to use higher version"
输出: