![](/img/trans.png)
[英]How can I write a command to shell script from a shell script without evaluating the command
[英]Trying to undersand how I can pass arguments from gradle to my shell script?
我试图通过gradle任务将命令行参数传递给我的shell脚本,而myconfiguration如下所示。
task dosomething(type:Exec) {
workingDir 'dir'
executable 'sh'
args '-c','source dosomething.sh $arg'
}
我正在尝试通过在终端中执行以下命令来传递它:
$ gradle dosomething -Parg=foo
我做错什么了吗?
Groovy仅对双引号字符串执行字符串插值。 (这就是为什么我默认使用双引号的原因之一。)尝试:
...
args "-c", "source dosomething.sh $arg"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.