bash 脚本内的 SVN 提交无法正常工作

发布于 2024-11-30 15:35:03 字数 600 浏览 2 评论 0原文

我有一个小示例脚本,它是一个更大脚本的一部分,除了 svn 提交部分之外,它运行良好。

root@dx-svn02:~# cat test.sh 
#!/bin/bash
CMD="svn update /mnt/checkout/dx-test/"
echo "INFO>>>: $CMD"
$CMD

CMD="svn commit -m 'Updated various bits' /mnt/checkout/dx-test/"
echo "$CMD"
$CMD
root@dx-svn02:~# ./test.sh 
INFO>>>: svn update /mnt/checkout/dx-test/
At revision 3.
svn commit -m 'Updated various bits' /mnt/checkout/dx-test/
svn: '/' is not a working copy
root@dx-svn02:~# svn commit -m 'Updated various bits' /mnt/checkout/dx-test/
root@dx-svn02:~# 

我真的不明白更新是如何工作的,但提交却不能。 任何帮助将不胜感激。

I have a small example script, part of a bigger script, which is working fine except for the svn commit part.

root@dx-svn02:~# cat test.sh 
#!/bin/bash
CMD="svn update /mnt/checkout/dx-test/"
echo "INFO>>>: $CMD"
$CMD

CMD="svn commit -m 'Updated various bits' /mnt/checkout/dx-test/"
echo "$CMD"
$CMD
root@dx-svn02:~# ./test.sh 
INFO>>>: svn update /mnt/checkout/dx-test/
At revision 3.
svn commit -m 'Updated various bits' /mnt/checkout/dx-test/
svn: '/' is not a working copy
root@dx-svn02:~# svn commit -m 'Updated various bits' /mnt/checkout/dx-test/
root@dx-svn02:~# 

I really don't understand how the update can work but the commit doesn't.
Any help would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独行侠 2024-12-07 15:35:03

当您插入单引号字符串时,它不会保留在引号中。

换句话说,您希望

ARGV[0] = svn
ARGV[1] = commit
ARGV[2] = -m
ARGV[3] = Updated various bits
...

...但是引用的方式,您会得到

ARGV[0] = svn
ARGV[1] = commit
ARGV[2] = -m
ARGV[3] = 'Updated
ARGV[4] = various
...

您可能最好使用 set -x 之类的东西来查看执行命令时的命令。

The single-quoted string doesn't remain quoted when you interpolate it.

In other words, you would like to have

ARGV[0] = svn
ARGV[1] = commit
ARGV[2] = -m
ARGV[3] = Updated various bits
...

... but the way the quoting works out, you are getting

ARGV[0] = svn
ARGV[1] = commit
ARGV[2] = -m
ARGV[3] = 'Updated
ARGV[4] = various
...

You're probably better off using something like set -x to see the commands as you execute them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文