title: BASH scripting: n-th parameter of $@ when the index is a variable?
body: <p>I want to retrieve the n-th parameter of $@ (the list of command line parameters passed to the script), where n is stored in a variable.</p>
  
  <p>I tried ${$n}.</p>
  
  <p>For example, I want to get the 2nd command line parameter of an invocation:</p>
  
  <pre><code>./my_script.sh alpha beta gamma
  </code></pre>
  
  <p>And the index should not be explicit but stored in a variable n.</p>
  
  <p>Sourcecode:</p>
  
  <pre><code>n=2
  echo ${$n}
  </code></pre>
  
  <p>I would expect the output to be "beta", but I get the error:</p>
  
  <pre><code>./my_script.sh: line 2: ${$n}: bad substitution
  </code></pre>
  
  <p>What am I doing wrong?</p>