title: How to use positional parameters with "bash -c" command?
body: <p>I'd like to know the best way of using positional parameters when using the command <code>bash -c</code>.</p>
  
  <p>The man pages indicates for the <code>-c</code> option that:</p>
  
  <blockquote>
    <p>If there are arguments after the command_string, they  are  assigned  to the positional parameters, starting with $0.</p>
  </blockquote>
  
  <p>So I guess that the following form is the right one:</p>
  
  <pre><code>$ bash -c 'printf "%s %s %s\n" $0 $1 $2' param1 param2 param3
  param1 param2 param3
  </code></pre>
  
  <p>However <a href="https://stackoverflow.com/a/38843259/2214695">I saw the following form</a>, and I wonder why it would be better</p>
  
  <pre><code>$ bash -c 'printf "%s %s %s\n" $1 $2' _ param1 param2
  param1 param2 
  </code></pre>
  
  <p>In this case, the character <code>_</code> replaces <code>$0</code>. </p>
  
  <p>I know that for many interpreters <code>$0</code> has a special meaning (command name, all positional parameters...), but in this case the man pages are quite clear.</p>
  
  <p>So, is there something wrong with the first form and is there any drawback of using <code>$0</code> as the first positional parameter for the <code>bash -c</code> command?</p>