escape variables in bamboo custom commands?

This question is in reference to Atlassian Documentation: Bamboo variables

Does anyone know how to escape a variable on a custom command? For example, I want to use ${PWD##*/}, which will get me the working directory without the path. This works on the command line but not when parsed through the bamboo interpreter since it matches the format bamboo uses for variables. 

1 answer

This widget could not be displayed.

Hello Rob,

Thank you for your inquire.

Could you provide us with an example to the "custom command" so we can evaluate the way ${PWD##*/} is being executed, please?

Kind regards,
Rafael P. Sperafico
Atlassian Support

Have /bin/mv added as a custom exe on the server & trying to do something like...

/bin/mv this.tar.gz /opt/atlassian/bamboo/home/xml-data/builds/${PWD##*/}/download-data/build_logs/

Hello Rob,

I have just test it using the following and the build ran successfully, mostly important, the file has been moved to the destination directory:


echo ${PWD##*/}

/bin/mv "foo.txt" "/opt/atlassian/home/atlassian-bamboo-5.10.0/xml-data/builds/${PWD##*/}/download-data/build_logs/"

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support


Can you confirm that Bamboo uses /bin/bash and NOT /bin/sh?

I have confirmed that bamboo uses sh when executing scripts, though if you setup the script as a command it runs it via bash

sh does not allow for array processes. this is an odd limit to impose.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,316 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you