title: How to source file from bash script
body: <p>I'm trying to source a file with an environment variable from my bash script, but it doesn't work. </p>
  
  <p>This is the content of my script (<code>test.sh</code>), which is located in <code>~/scripts/test.sh</code>.</p>
  
  <pre><code>#!/bin/bash
  FILE_NAME=/tmp/source_file
  touch $FILE_NAME
  echo "export TEST=\"test\"" &gt; $FILE_NAME
  source $FILE_NAME
  </code></pre>
  
  <p>Then I use <code>alias</code> in <code>my ~/.bashrc</code>.</p>
  
  <pre><code>alias testScript=~/scripts/test.sh
  </code></pre>
  
  <p>But when I use my script <code>testScript</code>, it didn't set the environment variable.</p>