title: bash shell store path to current file as variable?
body: <p>When starting a project in Python, I want to save some environment variables in a file called <code>environment_variables</code> and source this file in the bashrc.</p>
  
  <p>The file looks something like this: </p>
  
  <pre><code>username=$(whoami)
  
  # project root path
  export PROJECT_DIR='/home/'$username'/nuclei_segmentation/'
  
  # project data path
  export DATA_DIR=$PROJECT_DIR"data/"
  
  # location of models 
  export MODEL_DIR=$PROJECT_DIR"models/"
  
  # project output data
  export OUTPUT_DIR=$PROJECT_DIR"output/"
  </code></pre>
  
  <p>I would like to change the <code>PROJECT_DIR</code> path so it is platform/name independent. So this <code>environment_variables</code> file will always be in the root directory of the project and I want to set <code>PROJECT_DIR</code> to always be the location of the <code>environment_variables</code> file.</p>
  
  <p>I thought I could do this with <code>PWD</code> but when called from bashrc this creates an error, I also thought of a solution using find to search for the file from the root directory but this seems to complex and think there must be a better way?</p>