Grade createStartScript : need to generate classpath based on environment

Hi All
I have a requirement to add JAVA_OPTS conditionally.
Today In Maven I achieve this by using below in maven unix template

if ["$3"= “PROD”]; then

#$3 is the 3rd command line arg to the maven generated script.

How do I achieve this in gradle createStartScript?

Also the createStartScripts task of Gradle accepts custom templates.
So you can either use own templates for the start scripts, or you can post-process the file using some replace-logic in an doLast { ... } action.