Accessing $BASH_ENV Results in "No such file or directory"

Append To/Create $BASH_ENV

The $BASH_ENV environment variable holds a string that holds the location of a file in the /tmp directory. This is used to pass values between steps in a CircleCI Job.

Typically this is appended to and created within the same step:

- run: echo "export MY_ENV_VAR=example" >> $BASH_ENV

If a build tries to access that value before it has been created it will result in a not found error:

- run: cat $BASH_ENV
cat: /tmp/.bash_env-5f3d6eeXXXXXXXa54XXXX-0-build: No such file or directory

The solution can be to either make sure to run at least one step that appends values to the file listed in $BASH_ENV or to simply touch the file:

- run: touch $BASH_ENV

 

Additional Resources:

Was this article helpful?
4 out of 7 found this helpful

Comments

0 comments

Article is closed for comments.