当前位置:网站首页>Shell脚本——文件的备份,更新和回滚
Shell脚本——文件的备份,更新和回滚
2022-07-26 22:44:00 【单纯的一比】
Shell脚本——文件的备份,更新和回滚
脚本
#!/bin/bash
read -p "请输入想要备份到的目录的绝对路径:" a
#这里用函数和变量都行,也可以不用
beifen () {
rsync -arv /mnt/1.txt $a
}
gengxin () {
rsync -auvr -delete /mnt/1.txt $a
}
huigun () {
rm -rf /mnt/1.txt
cp -rfp $a/1txt /mnt
}
read -p "请输入想要执行的操作(A:备份、B:更新、C:回滚):" b
case $b in
A)
beifen
;;
B)
gengxin
;;
C)
huigun
;;
*)
echo "no"
exit
esac
执行

END
边栏推荐
猜你喜欢
随机推荐
[SQL injection] joint query
Unity 截屏小工具
Download pronunciation pairs+ship or sheet+tree or three
【unity】Unity界面scene视图[1]
Unity[1] learning directory
六、if语句
[Oracle] get the latest working day and the previous N working days
6、 If statement
ESP8266 AP_ TCP_ Server
Code merging of centralized version control tools
9、 Bubble sort
15、 Expect
FaceNet
Promoting practice with competition - Reflection on the 303th weekly match
ESP8266接入云平台------DNS 域名连接服务器
Some simple extension methods commonly used by unity
C language to realize mine sweeping game:
2. Wrong odometer
Basic syntax of Verilog
if 与 else if 的区别









