Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Can I access a deployment environment variable within a shell script?


I have a file named `` in the repository and I want to access some pipeline environment variables within the script.

I use the following command in my `bitbucket-pipelines.yml` file:

ssh user@host 'bash -s' < ''

The `` contains some environment variables that are defined in the pipeline:


The `TEST_FOLDER_PATH` defined in the `Test` environment as follows:Screenshot 2019-01-07 at 13.37.13.png

So, the question is, how do I read the `TEST_FOLDER_PATH` within the `` file?




1 answer

0 votes

Shell scripts executed from bitbucket-pipelines.yml can access such environment variables just fine, but they have to be executed as part of the step, e.g.


From your question, it looks like you're trying to execute your script on a remote host, triggered by a Pipeline. The remote host won't have any knowledge of the environment variables set up by pipelines, so you'd need to pass those along as arguments to the remote script invocation some how. Hard to be more specific without knowing what the script does, what the env vars are, etc.

And what if we executing script remotely using atlassian/ssh-run ?

Were you able to solve this problem? 

Now I am trying to do the same thing. 

Could you help me?

Need to use something like

ssh user@host 'bash -s' < " $TEST_FOLDER_PATH"

And process it as  parameter in your

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,265 views 2 9
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you