Bash Tarball脚本失败退出
有人能告诉我为什么下面的脚本失败了吗?我想不出来Bash Tarball脚本失败退出,bash,shell,unix,tar,Bash,Shell,Unix,Tar,有人能告诉我为什么下面的脚本失败了吗?我想不出来 #!/bin/bash D="$(date +%V).tar.bz2" E="$(date +%V).tar" P="mnt/Xendata/Weekly/" tar cjvf $P"dbtime_week_"$D --newer="1 weeks ago" mnt/DBTime tar cjvf $P"pounds_week_"$D --newer="1 weeks ago" mnt/Pounds tar cjvf $P"fts_wee
#!/bin/bash
D="$(date +%V).tar.bz2"
E="$(date +%V).tar"
P="mnt/Xendata/Weekly/"
tar cjvf $P"dbtime_week_"$D --newer="1 weeks ago" mnt/DBTime
tar cjvf $P"pounds_week_"$D --newer="1 weeks ago" mnt/Pounds
tar cjvf $P"fts_week_"$D --newer="1 weeks ago" mnt/FTS/DB\ Backups
tar cjvf $P"projects_week_"$D --newer="1 weeks ago" mnt/Projects
tar czvf $P"groups_week_"$E --newer="1 weeks ago" --ignore-case --exclude=*Expo*Films* --exclude=*/Promo\ Material/* mnt/Groups
tar czvf $P"users_week_"$E --newer="1 weeks ago" --ignore-case \
--exclude=*cache* \
--exclude=*dvdproj* \
--exclude=*iDVD* \
--exclude=*IMAP* \
--exclude=*Temporary.localized* \
--exclude=*.app* \
--exclude=*Spotlight* \
--exclude=*iTunes* \
--exclude=*/Library/PubSub* \
--exclude=*/Downloads/* \
--exclude=*.mpg \
--exclude=*.mov \
--exclude=*.mp4 \
--exclude=*.m4v \
--exclude=*/dev/* \
--exclude=*ladmin* \
--exclude=*/widgets/* \
mnt/Users
exit $?
这是输出。大部分都通过了,但后来失败了:
tar: mnt/Groups/~$xxxxxx.xls: file is unchanged; not dumped
tar: Option --after-date: Treating date `1 weeks ago' as 2012-07-19 17:29:42.104908153
tar: : Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
tarball_weekly: line 25: --exclude=*Spotlight*: command not found
tarball_weekly: line 29: --exclude=*.mpg: command not found
是否确定行尾的反斜杠后没有字符:
cat -ve tarball_weekly
要查看$(行尾)之前是否有^M个字符,例如(格式化dos)前一行末尾有一个空格。谢谢