![](/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.