在gradle exec任务中使用bash glob

Adr*_*sbe 5 bash glob gradle

我正在构建一个gradle Exec任务,意味着只需调用一个基本sed命令,让我们说: sed -i 's:some:substitution:' *

什么是正确的语法或gradle函数/变量,以使*glob在一些bash/zsh shell中匹配的文件替换?

换句话说,如何触发shell扩展


到目前为止我尝试的是:

task myTask(type: Exec){

    workingDirsome dir

    commandLine 'sed', '-i', 's:some:substitution:', "*"
}
Run Code Online (Sandbox Code Playgroud)

但是我得到一个错误:sed: can't read *: No such file or directory这并不令人惊讶.

hek*_*mgl 9

您需要启动包装在shell中的命令:

commandLine 'bash', '-c', 'sed -i "s:some:substitution:" *'
Run Code Online (Sandbox Code Playgroud)