如何在Linux OS上运行时在gradle脚本中转义空间?(How to escape space in gradle script while running it on Linux OS?)

系统教程 行业动态 更新时间:2024-06-14 16:52:52
如何在Linux OS上运行时在gradle脚本中转义空间?(How to escape space in gradle script while running it on Linux OS?)

我在Windows和Linux操作系统上运行我的gradle脚本。当我在Windows操作系统上运行它时运行正常。我正在尝试执行hg命令来创建标记并将其推送到repository.Script工作正常。问题是标签名称。我使用下面的命令应用标签,该命令在Windows OS上正常运行.Gradle脚本正在运行此命令。

commandLine "hg tag -r $hash \"Build $cbversion\"".split()

但是同样的命令在Linux OS上运行时会抛出一个错误,而不会将该标记与Build 1.2.3.4名称一起使用。我尝试了下面的命令,但没有运气

commandLine "hg tag -r $hash Build $cbversion".split()

那么它会创建名称仅为Build的标签

有人能告诉我如何克服这个问题?

I am running my gradle script on both windows and Linux OS.This is running fine while I run it on Windows OS.I am trying to execute the hg command to create the tag and push it to repository.Script is working fine.The issue is tag name.I apply the tag with below command which is running fine on windows OS.Gradle script is running this command.

commandLine "hg tag -r $hash \"Build $cbversion\"".split()

But the same command is throwing an error while running on Linux OS and not applying the tag with Build 1.2.3.4 name.I tried below command but no luck

commandLine "hg tag -r $hash Build $cbversion".split()

then it creates the tag with name Build only

Could someone tell me how could I overcome from this problem?

最满意答案

这是exec进程而不是shell。 你不能在这里引用它来使它工作。 commandLine要么采用数组,要么将iteratable作为参数。 例如:

commandLine 'hg', 'tag', '-r', hash, "Build $cbversion"

This is executing a process and not the shell. You can not quote here to make it work. commandLine either takes an array or iteratable as arguments. E.g.:

commandLine 'hg', 'tag', '-r', hash, "Build $cbversion"

更多推荐

本文发布于:2023-04-05 12:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/f590b005e3c69292e811f67afbf7a875.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   如何在   空间   OS   running

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!