Issue
I am working in a legacy codebase where the is existing code that uses ${...}
syntax for interpolation. Now I want to add some bash
script which also happens to use ${}
in some places. Now there is a clash. I want to use a different interpolation syntax (ex: {{}}) for only those shell scripts. How to do that?
# sample script
.
.
command: /home/../schipt.sh ${datetime} <-- don't want to replace ${datetime}
Solution
There's an alternative, square bracket interpolation syntax, that you can enable with Configuration.setInterpolationSyntax(SQUARE_BRACKET_INTERPOLATION_SYNTAX)
. With that FreeMarker interpolations are like [=expression]
, instead of like ${expression}
.
See more here: https://freemarker.apache.org/docs/dgui_misc_alternativesyntax.html
There's a similar tag syntax setting, setTagSyntax(SQUARE_BRACKET_TAG_SYNTAX)
, with which tags look like [#assign x = 1]
, instead of <#assign x = 1>
. That's independent of the interpolation syntax, but maybe you want to set both, so people will notice easier that we are in some non-default syntax (square brackets everywhere).
Answered By - ddekany Answer Checked By - David Goodson (WPSolving Volunteer)