title: How to execute execv() without full directory on OSX or LINUX?
body: <p>in C  shell programming, I learn that I can function use such as  <code>execv("/bin/ls",argv)</code> to perform the termial function <code>"ls"</code>. However, <code>execv()</code> requires  full path of the function. </p>
  
  <p>I wrote my C file, in the C file I am accessing the shell, but I still use terminal to compile it and pass in arguments. </p>
  
  <p>I want to simulate the termimal "ls", at the moment I can use <code>execv("/bin/ls",argv)</code> to do it,which means I have to type "/bin/ls" as arguments which will be passed to the executible. </p>
  
  <p><strong>Now,I would rather just type "ls"  to do the task (basically saving the path typing) without the path name, how should I do it?</strong></p>
  
  <p>On OXS,<strong>default path is</strong>  <em>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</em>, </p>
  
  <p>I have try to put <code>execv(PATH,argv)</code> but it gives nothing when I type <code>ls</code></p>
  
  <p>THank you</p>