Making a Bamboo Script execute using /bin/bash

I need to run a script using /bin/bash instead of /bin/sh, but I'm not seeing a way to do that.

In the logs, I see that /bin/sh is used to execute my script. In my script, I print out the $SHELL variable, and nothing shows up on the screen. So, I assume it's /bin/sh that's being used to run the script... but I can't confirm it. Putting #!/bin/bash at the top of my script doesn't help.

The reason I need to use /bin/bash is that a process I need to start requires a set of environment variables to be set using a an inline function (e.g., source `rosstack find orocos_toolchain`/ but I don't believe /bin/sh supports that, or the source call.

3 answers

1 accepted

0 votes
Colin Goudie Community Champion Jan 10, 2012

You should be able to add a new builder from the builders admin menu {URL}/admin/agent/viewBuilders.action

e.g. on our Bamboo instance our Bash builder uses /bin/bash

Good Day

I currently have this problem and not sure where to find this builders admin menu.  Our system actually runs on bin\ksh but bin\bash will do for this instance as we just need a script to run

Could you possibly send a screenshot.

I am using Bamboo:

Bamboo version information
Build number51117
Build date 4/28/16


Please help

The accepted answer works if you are running a "command" task from bamboo (i.e. execute a script file).

If you are trying to run a "script" task, which is just running an inline script, you can try putting this snippet at the top to force it to execute in bash. It's a hack, but it worked for me:


if [ "$(ps -p "$$" -o comm=)" != "bash" ]; then
    # Taken from
    bash "$0" "$@"
    exit "$?"

Champion! worked for me

Very nice! Thanks!

Woohoo! Thanks. You would expect this to be simpler with bamboo....Atlassian, are you listening?

No. Atlassian has no time for small fundamental details

This really sucks when you have to bootstrap it in 30 different script tasks.

I was able to achieve this by adding below to my script itself



Tried this but did not work for me

In Bamboo < 5.13, on the agents, if the non-login shell is bash, it should work adding the she-bang on script tasks. 

You can achieve that by linking /bin/sh to /bin/bash, instead of /bin/dash or whatever.


From 5.13, it should work regardless of your non-login shell.

How can I achieve this without upgrading.

Currently running:

Bamboo version information
Build number51117
Build date4/28/16

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,070 views 0 5
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot