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: 

Unable to set local vars from plan vars in script

Max van den Berk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 11, 2021

When I define anypoint_username=MyUserName as a Project variable,
I am not able to access it in a script task as documented in:
https://confluence.atlassian.com/bamboo0608/bamboo-variables-970619468.html

if [ -z "${bamboo.anypoint_username}" ]; then
echo "bamboo.anypoint_username not found, please set global variable."
usage
fi
anypoint_username="${bamboo.anypoint_username}"

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

3 votes
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 11, 2021

Hello @Max van den Berk

Welcome to Atlassian Community!

To use variables in Bash, your need to call them differently:

Using variables in bash

Bamboo variables are exported as bash shell variables. All full stops (periods) are converted to underscores. For example, the variable bamboo.my.variable is $bamboo_my_variable in bash. This is related to File Script tasks (not Inline Script tasks).


Kind regards,

Eduardo Alvarenga
Atlassian Support APAC

Max van den Berk
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 2, 2021

Thank you, I'm so new I didn't even realise an answer was already given!

TAGS
AUG Leaders

Atlassian Community Events