我需要 shell 脚本的帮助,这个脚本在我的电脑上运行 ubuntu 14.10,但在 samba 服务器机器 ubuntu 14.04 上显示错误:tar 您可能没有指定多个 -acdtrux' 选项 --delete 或 test-label.... 请帮忙。脚本适用于 10 天前的存档文件。有脚本:
#!/bin/sh
# What to backup.
backup_files="/usr/*"
# Where to backup to.
dest="/home/milan/Desktop"
# Create archive filename.
day=$(date +%F)
hostname=$(hostname -s)
archive_file="$hostname-$day.tgz"
# Print start status message.
echo "Backing up $backup_files to $dest/$archive_file"
date
echo
# Backup the files using tar.
files=$(find $backup_files -type f -mtime -10)
sudo -s tar cf $dest/$archive_file $files
#files=($(find /usr -mtime -7))
#tar cvfz $dest/$archive_file.tar.gz "${files[@]}"
# Print end status message.
echo
echo "Backup finished"
date
# Long listing of files in $dest to check file sizes.
ls -lh $dest