title: Arguments being passed into execv in C
body: <p>I am writing a program in C that forks and uses execv to call a command that is passed in to the original function.  </p>
  
  <p>So I would type in something like "./program echo "hello"" and the child of the fork in my program would use the bash command "echo hello".</p>
  
  <p>The execv man page is pretty vague, it says "The first argument, by convention, should point to the filename associated with the file being executed."  I am trying to figure out if I'm understanding this right.</p>
  
  <p>From examples I've seen, this is how execv should be called:</p>
  
  <pre><code>execv(argv[0], argv);
  </code></pre>
  
  <p>But I know that argv[0] would just contain "./program".  So I am thinking this just exec's to the same function its inside of, but it is not what I've seen in examples. </p>
  
  <p>From what I know it should be this:</p>
  
  <pre><code>execv(argv[1],argv+1);
  </code></pre>
  
  <p>or </p>
  
  <pre><code>execv(argv[1],argv+2);
  </code></pre>
  
  <p>Can anyone help me understand this? Thanks.</p>