Write literal bash script in kotlin string?
How can I create a bash script as a multi-line string without kotlin/idea trying to interpret the contents? The below snippet has all kinds of errors in idea because kotlin is trying to find the bash variables.
```
scriptContent = """
#!/bin/bash
set -e
source $HOME/.nvm/nvm.sh &>/dev/null && nvm install
version=$(jq -r .version package.json)
build_number=${BUILD_NUMBER:-SNAPSHOT}
semver=( ${version//./ } )
newVersion="${semver[0]}.${semver[1]}.$build_number"
echo "##teamcity[setParameter name='vi-version-number' value='$newVersion']"
echo "##teamcity[buildNumber '$newVersion']"
echo "SET vi-version-number=$newVersion"
echo "SET buildNumber=$newVersion"
npm version $newVersion --force -m "[teamcity] Update version number to %vi-version-number%"
""".trimIndent()
```
Please sign in to leave a comment.
Do I really have to do this? There is no way to just create literal string in kotlin?
```
And now I can't use idea's nested language to edit the bash because it isn't valid bash anymore...
Hi Barry,
this is a limitation of kotlin as a language indeed, there is an issue in Kotlin's project in the issue tracker for it: https://youtrack.jetbrains.com/issue/KT-2425, please watch and vote for it.
In the meantime, I'm afraid there isn't much more we can recommend. You could try setting it as an external script and either keep it in VCS and use the file as the step rather than specifying the content, or keep the file loaded with the VCS settings and load the content of the file and assign it as the script content.