如何在centos中编写svn-shell脚本



我有一个位于CentOS的网站,它使用SVN进行更新和提交。

我想通过crontab编写一个shell脚本来自动运行计划工作。

我测试了一个SVN命令,SVN status |grep^
它显示的结果如下:

M index.php<br/>
M data/config.php<br/>
? date/aaa.php<br/>
? images/bbb.php<br/>
? images/product1.jpg<br/>
? images/product2.jpg<br/>
? themes/ccc.php<br/>
? themes/index.html<br/>
? temp/compiled/index.php<br/>
? temp/compiled/article.php<br/>
? temp/compiled/footer.php<br/>

我写了一个SVN命令,它可以删除所有的撤销和修改php文件,如下所示:

svn状态--无忽略|grep";。php$"|sed的/^?//'|xargs rm-rf

我想写一个可以帮助我的shell脚本:

  • 删除取消版本文件,修改文件除外
  • 仅删除php文件
  • 在临时文件夹中执行文件

请帮帮我,谢谢所有

使用带有选项-v的grep来排除temp下的文件路径。为了使命令更安全,我还会跳过rm命令中的-r-f

svn status --no-ignore | grep '^?.*.php$' | grep -v '^? *temp/' | sed 's/^? *//' | xargs rm

最新更新