1
運行在bash此命令:如何在Groovy的外殼擴展?
echo *
給出這個輸出:
echo.groovy文件1文件2
經由常規運行相同的命令:
print 'echo *'.execute().text
給出:
*
我意識到這是因爲*
擴展外殼環境進行的。所以我試試這個:
print '/bin/bash -c "echo *"'.execute().text
這沒有任何結果。
我怎麼能在Groovy中執行shell命令同時服用shell擴展的好處?