这是我用于备份的脚本
#!/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.
如何解决这个问题?
答案1
$scripts
如果只有这些行,则为空