常用脚本开头

#!/bin/bash
#定义字体颜色
function RedFont(){
  echo -e "\033[31mError: $1 \033[0m"
}

function GreenFont(){
  echo -e "\033[32mSuccess: $1 \033[0m"
}

function YellowFont(){
  echo -e "\033[33mWarning: $1 \033[0m"
}
#判断上一次执行成功
function Status_Judge(){
 if [ $? -eq 0 ];then
   GreenFont "$1"
 else
   RedFont "$2"
   exit
 fi
}

你可能感兴趣的:(shell,linux,bash)