备份和恢复配置文件时使用
#!/bin/bash # backup file [ -e $1 ] && cp -p $1 $1.`date +%F.%T`.bak && echo -e "\t\t\t\t\t\e[32m OK \e[0m" || echo -e "\t\t\t\t\t\e[31m Failed \e[0m"
#!/bin/bash # unbackup file file_name=`echo $1 | sed "s/\.2.*bak$//"` [ -e $1 ] && mv $1 $file_name && echo -e "\t\t\t\t\t\e[32m OK \e[0m" || echo -e "\t\t\t\t\t\e[31m Failed \e[0m"