Here's my script:
read -p 'commit message: ' msg
svn status | grep ^\? | awk '{ print $2 }' | egrep "\.(py|js|html|png|jpg)$" | xargs svn add
svn ci -m "$msg"
When I run it, however, I get this error:
mark@mark-ubuntu:~/myproject$ ./commit.sh
commit message: test
svn: Try 'svn help' for more info
svn: Not enough arguments provided
I really don't know much about shell programming. Is the message not being passed to svn ci
properly or what? How can I make it work?
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'
The svn ci line seems fine. You can try running it with bash -x to see where the error is:
$ bash -x commit.sh
精彩评论