这是我的脚本:
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'
最佳答案
svn ci 行似乎很好。您可以尝试使用 bash -x 运行它以查看错误所在:
$ bash -x commit.sh
关于svn - 如何使用来自 `read` 的变量作为另一个程序的参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6811255/