The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events