Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

no such file or directory when executing shell script through ssh-run pipe


i setup a CD pipeline for one of my projects that first is using rsync to sync the code to the remote server and then executes a shell script on the remote server through the



the shell script on the remote server, among other things, runs the following function:

#define function that will export env vars
function export_envs() {
local envFile=${1:-.env}
while IFS='=' read -r key temp || [ -n "$key" ]; do
local isComment='^[[:space:]]*#'
local isBlank='^[[:space:]]*$'
[[ $key =~ $isComment ]] && continue
[[ $key =~ $isBlank ]] && continue
value=$(eval echo "$temp")
eval export "$key='$value'";
done < $envFile
#run the command


The thing now is that if the pipeline triggers this shell script, it fails because of this:

/www/htdocs/w01b3634/test/ line 10: .env: No such file or directory

however, if I run the command by hand on the remote server, it does work.

the .env file on the remote server does exist of course...


Any clue what I'm doing wrong?

1 answer

1 accepted

0 votes
Answer accepted

found it. I had to specify the absolute url of the .env file in the function...

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,821 views 10 16
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