Current folder path for calling another script


In my steps I prefer to split scripts by multiple files. To be able to execute them I need to extract current folder path, like this SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" and than do something like this "${SCRIPT_DIR}/my_script".

Is it possible to provide SCRIPT_DIR as Env variable like BITRISE_GIT_BRANCH and others?



Hi @ned,

Unfortunately there’s no way to do this through the GUI however you can add the environment variable in a script step to do so and it will compute the response there.



Hi, my question was more related to developing custom steps. For example in my step I can check if it’s $PR ( or not. It would be also nice to have the same env variable in Bitrise but with current step folder. So I wouldn’t need to repeat the same script in my own steps



This is not currently possible as far as I know. You will have to do it as you have been.

1 Like