title: Passing command line arguments through Bash
body: <p>While brushing up on bash (it's been a while), I was surprised to notice that executing this code, saved as script.sh:</p>
  
  <pre><code>echo "Arg 0 to script.sh: $0"
  echo "Arg 1 to script.sh: $1"
  function echo_args
  {
      echo "Arg 0 to echo_args: $0"
      echo "Arg 1 to echo_args: $1"
  }
  echo_args
  </code></pre>
  
  <p>like this:</p>
  
  <pre><code>&gt;&gt; ./script.sh argument
  </code></pre>
  
  <p>output this:</p>
  
  <pre><code>Arg 0 to script.sh: ./script.sh
  Arg 1 to script.sh: argument
  Arg 0 to echo_args: ./script.sh
  Arg 1 to echo_args:
  </code></pre>
  
  <p>I was surprised to see that $0 of script.sh was passed as $0 to echo_args when $1 is not treated similarly.  It seems to me it should be both or neither.</p>
  
  <p>Any clarification is appreciated.</p>