title: Executing binary files using exec* in c
body: <p>I am creating a toy shell. I want to execute a binary file which is either located in the PATH variable or the current directory. This is what I am doing to achieve it:</p>
  
  <pre><code>execl(filePath," -e ",com.arguments,NULL);  //e.g of filePath: /home/dino/programs/mywrapper
  </code></pre>
  
  <p>Now it works fine for some executables like <code>which</code> command. But for commands like <code>tar</code>, a whole bunch of error throws up.</p>
  
  <p>Basically all I want is the <code>execl</code> to execute the executable mentioned in <code>filePath</code> in my shell. How do I do it?</p>
  
  <p><strong>EDIT:</strong>
  <code>com.arguments</code> is the arguments list. For example in <code>which bash</code>, <code>bash</code> becomes my argument. In <code>tar -zvcf bazinga.tar.gz bazinga/</code>, <code>-zvcf bazinga.tar.gz bazinga/</code> becomes my arguments etc. </p>