首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bash Tarball脚本退出失败

Bash Tarball脚本退出失败
EN

Stack Overflow用户
提问于 2012-07-26 15:46:49
回答 1查看 247关注 0票数 0

谁能告诉我为什么下面的脚本失败了?我想不出来。

代码语言:javascript
复制
#!/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 $?

这是输出。它的大部分都通过了,但后来失败了:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-26 16:24:07

您确定行尾的反斜杠后面没有字符吗:

代码语言:javascript
复制
cat -ve tarball_weekly

要查看$(行尾)之前是否有^M个字符,例如(format dos)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11664657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档