1
我正在嘗試在引號內將hostname
寫入文件。我正在用Groovy腳本來做這件事。這是我的sh Groovy腳本。Groovy sh命令不包括我的回顯命令中的引號
sh "echo Add \"my-hostname\" \"$HOSTNAME\" >> /etc/test.conf"
在/etc/test.conf
我預期的結果應該是:
Add "my-hostname" "linux-base"
但是,當我執行我的Groovy腳本的結果是:
Add my-hostname linux-base
有人請幫我在sh
命令腳本。
試試這種[添加雙引號](http://glu.977617.n3.nabble.com/Add-double-quotes-in-a-string-in-groovy-script-td4026207.html)。 –