Gradle generated installApp shellscript does not work on AIX bash

We are creating a standalone java program runnable via a shell script on AIX using gradle.

The gradle generated shellscript contains the following lines:

cd “‘dirname “$PRG”’/…” >&- APP_HOME="‘pwd -P’" cd “$SAVED” >&-

This does not work on AIX bash

We get the following error on AIX: ./executablename: line 65: pwd: write error: A file descriptor does not refer to an open file. Error: Could not find or load main class packagename.Classname

and we are forced to change these lines to

cd “‘dirname “$PRG”’/…” APP_HOME="‘pwd’" cd “$SAVED”

to make it work on AIX.

This is using the gradle application plugin and the task is installApp gradle version 2.1