Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Escape Variable in Command

Travis January 9, 2020

Having an issue with the double parsing of local variables that contain spaces. Two parts to this: what's the best way to initialize strings with spaces, ie which quotes to use, and how do they get escaped as part of a command? See the following example...

Let's say we create a command in the script section as

- export AUTHOR="My name goes here"

Are double quotes what should be used?

Next, we have a separate command that will use that variable as a parameter

- madeupcommand --author "$AUTHOR"

Here I'm escaping the $AUTHOR variable based on Atlassian documentation (https://confluence.atlassian.com/bitbucket/advanced-techniques-for-writing-pipes-969511009.html). However, made up command only receives My. I've tried escaping $AUTHOR with various quotes and escape combinations but can't get the whole string to get passed in. How should $AUTHOR be escaped then?

More generally, is there any documentation discussing how quotes are interpreted as single quote, double quote, and accents all do different things?

Thanks!

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events