title: Getting value of environment variable in unix
body: <p>I have a properties file to set some environment variables say:</p>
  
  <pre><code>mydata.properties:
  
  VAR1=Data1
  VAR2=Data2
  </code></pre>
  
  <p>Now I want to define a new variable called VAR3 that can hold either VAR1 or VAR2 like:</p>
  
  <pre><code>mydata.properties:
  
  VAR1=Data1
  VAR2=Data2
  VAR3=VAR2
  </code></pre>
  
  <p>To make these variables to be available to my bash session I am using this command</p>
  
  <pre><code>source mydata.properties
  </code></pre>
  
  <p>Now my requirement is to print the value for VAR3 so that it can print the internal data of the sourced VAR2 variable like:</p>
  
  <pre><code>Value of VAR3 is Data2
  </code></pre>
  
  <p>I tried different options like </p>
  
  <p><code>echo "Value of VAR3 is $$VAR3"</code> </p>
  
  <p>This gives me junk output.</p>
  
  <p>or <code>echo "Value of VAR3 is ${$VAR3}"</code></p>
  
  <p>This give me error as <code>Value of ${$VAR3}: bad substitution</code></p>
  
  <p>Please help me how to get this output.</p>