这是我的剧本:
read -p 'commit message: ' msg
svn status | grep ^\? | awk '{ print $2 }' | egrep "\.(py|js|html|png|jpg)$" | xargs svn add
svn ci -m "$msg"
然而,当我运行它时,我收到此错误:
mark@mark-ubuntu:~/myproject$ ./commit.sh
commit message: test
svn: Try 'svn help' for more info
svn: Not enough arguments provided
我真的不太了解shell编程。消息是否未正确传递给svn ci
或者是什么?我怎样才能使它发挥作用?
mark@mark-ubuntu:~/myproject$ bash -x commit.sh
+ read -p 'commit message: ' msg
commit message: hello world
+ egrep '\.(py|js|html|png|jpg)$'
+ xargs svn add
+ awk '{ print $2 }'
+ grep '^?'
+ svn status
svn: Try 'svn help' for more info
svn: Not enough arguments provided
+ svn ci -m 'hello world'
答案 0 :(得分:2)
svn ci线看起来很好。您可以尝试使用bash -x运行它以查看错误的位置:
$ bash -x commit.sh