4

I'm trying to pass command line arguments to my shell script through a gradle task myconfiguration is like this below.

task dosomething(type:Exec) {
  workingDir 'dir'
  executable 'sh'
  args '-c','source dosomething.sh $arg'
}

And I'm trying to pass it by doing the the following command in the terminal:

$ gradle dosomething -Parg=foo

And it does not work am I doing something wrong?

1 Answer 1

9

Groovy only performs String interpolation for double-quoted Strings. (That's one of the reasons why I use double quotes by default.) Try:

...
args "-c", "source dosomething.sh $arg"
Sign up to request clarification or add additional context in comments.

1 Comment

Peter you are the most beautiful person in the whole world thanks so much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.