title: Accesing environment variables with $ and ENV in ruby
body: <p>I am trying to acces an environment variable set in ~/.bashrc</p>
  
  <p>In ~/.bashrc I have set</p>
  
  <pre><code>export testdata = &lt;some path&gt;
  </code></pre>
  
  <p>without the &lt;> of course.
  I may add that I also tried adding</p>
  
  <pre><code>testdata=&lt;some path&gt;
  </code></pre>
  
  <p>to /etc/environment</p>
  
  <p>When I am still in the shell I can do</p>
  
  <pre><code>echo $testdata
  </code></pre>
  
  <p>which gives  as result
  When in my script I can do</p>
  
  <pre><code>puts ENV['testdata']
  </code></pre>
  
  <p>which will print 
  So far so good. However I another script that was not written by me where there is a line like</p>
  
  <pre><code>if $testdata then
  #some code
  end
  </code></pre>
  
  <p>which is supposed to just execute the code when the environment varaible is set. However this code is not working for me. Only when I replace $ with ENV[] the code is correclty executed.</p>