Linux备份文件的Shell小脚本
程序员文章站
2022-06-29 12:58:04
...
实现一个小小的交互式备份文件的功能
#!/bin/bash
CB="\033[1;32m"
CE="\033[0m"
DATE=`date +%F_%T`
read -p "Please enter the full path of your DIR:" SDIR
DEST=/data/backup/${SDIR}_${DATE}
echo -e "${CB}Starting Backup ${SDIR} ${CE}"
sleep 3
cp -av ${SDIR} ${DEST}
echo -e "${CB}ohohohoh……${CD}"