下面是我用于备份的脚本
#!/bin/bash
src_dir=/home/ubuntu/scripts
tgt_dir=/home/ubuntu/backups
curr_timestamp=$(date "+%Y-%m-%d-%H-%M-%S")
backup_file=$tgt_dir/$curr_timestamp.tgz
echo "Taking backup on $curr_timestamp"
echo "$backup_file"
#tar -cf back_file.tar ./*
tar czf $backup_file --absolute-names $scripts
echo "Backup complete"
它对我不起作用,而且出错了。
tar: Cowardly refusing to create an empty archive
Try 'tar --help' or 'tar --usage' for more information.
如何解决这个问题?
发布于 2022-08-22 21:06:05
如果只有这些行,$scripts
是空的
https://askubuntu.com/questions/1425090
复制相似问题