CreateStartScripts in Application plugin escapes $ whether you want it to or not

Traditionally, our application startup script has used a shell variable in the JVM options to supply an ID to our application. E.g.

-DappId=$appId

Recently, we switched to Gradle and began using the Appliation plugin to generate our startup scripts. However, the CreateStartScripts task is escaping every $ to $. In our case, we don’t want it to. It would be useful if the task had an option like “dontEscapeShellVariables” or something that could toggle this.

Can you provide steps to reproduce please. There’s a number of ways to supply JVM options that the application plugin’s start scripts might be involved in so I’d like narrow it down.

Sure, we just have this in our application’s build.gradle

startScripts {
    defaultJvmOpts = ['-DinstanceId=$instanceId']
}

Oh, and we create the scripts themselves by running the distTar task, although the same scripts are generated when you run the install distZip and install tasks.

Raised as GRADLE-3084.

I had some spare time and thought I would take a stab at this. I created a pull request https://github.com/gradle/gradle/pull/422