当前位置: 技术问答>linux和unix
求解这段bash脚本
来源: 互联网 发布时间:2016-11-19
本文导语: #!/bin/sh if [ `date +%w` -eq 0 ];then tar -g /var/bak/shap_`date +%Y`_`date +%U` -zcf /var/bak/eyou.backup_full_`date +%Y`_`date +%U`.tar.gz /var/eyou rm -rf /var/bak/eyou.backup_append_`date --d '5 day ago' +%Y`_`date --d '5 day ago' +%U`_*.tar.gz else tar -g /var/ba...
#!/bin/sh
if [ `date +%w` -eq 0 ];then
tar -g /var/bak/shap_`date +%Y`_`date +%U` -zcf /var/bak/eyou.backup_full_`date +%Y`_`date +%U`.tar.gz /var/eyou
rm -rf /var/bak/eyou.backup_append_`date --d '5 day ago' +%Y`_`date --d '5 day ago' +%U`_*.tar.gz
else
tar -g /var/bak/shap_`date +%Y`_`date +%U` -zcf /var/bak/eyou.backup_append_`date +%Y`_`date +%U`_`date +%u`.tar.gz /var/eyou
fi
exit 0
求解这段代码意思,(目前只知道是备份及删除)。特别是参数的意思,比如tar -g
rm -rf 后面的 --d是什么意思?
|
man tar
-g, --listed-incremental=FILE
handle new GNU-format incremental backup
-g, --listed-incremental=FILE
handle new GNU-format incremental backup