title: Bad substitution error in bash script
body: <p>I have tried a lot but couldn't get the solution out of it. I have a simple script:</p>
  
  <pre><code>#! /bin/sh
  o="12345"
  a=o
  b=${!a}
  echo ${a}
  echo ${b}
  </code></pre>
  
  <p>When executed like</p>
  
  <pre><code>$ . scp.sh
  </code></pre>
  
  <p>it produces the correct output with no errors, but when executed like:</p>
  
  <pre><code>$ ./scp.sh
  </code></pre>
  
  <p>it produces </p>
  
  <blockquote>
    <p>./scp.sh: 4: ./scp.sh: Bad substitution</p>
  </blockquote>
  
  <p>Any ideas why this is happening. </p>
  
  <hr>
  
  <p>I was suggested to use bash mode and it works fine. But when I execute this same script through Python (changing the script header to bash), I am getting the same error.</p>
  
  <p>I'm calling it from Python as:</p>
  
  <pre><code>import os
  os.system(". ./scp.sh")
  </code></pre>