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

0 votes

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 Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

274 views 0 12
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