Issues
Issues copied to clipboard
Insert variable in a script doesn't work for some variables in bash
Severity
Workaround available
Version
All versions
Latest Version
I could reproduce the problem in the latest build
What happened?
When calling get_octopusvariable in a bash script, variable names that contain quotes or backticks will not work when executed.
Reproduction
Create a variable containing a back tick or a quote For example:
In a bash script step, use the insert variable functionality to insert the variable. The resultant generated code will be wrong.
echo $(get_octopusvariable "with a "quote"")
echo $(get_octopusvariable "with a `backtick`")
Output will do nothing for the quote mark, for the back tick it will error
/etc/octopus/main/Work/POVAJjoFCUSgpHFVG8Plg/Script.sh: line 4: backtick: command not found
Error and Stacktrace
More Information
No response
Workaround
Workaround is to escape the quote and backticks inside the variable name
echo $(get_octopusvariable "with a \"quote\"")
echo $(get_octopusvariable "with a \`backtick\`")