title: Why am I having difficulty making execvp in C work?
body: <p>I need to implement a basic shell in C.
  One of things I need is to implement a function that has a command and to execute it.
  my code:</p>
  
  <pre><code>    pID=fork();
  
      if (pID == 0)
         execvp(tmp[0], tmp);
      else if (pID &gt; 0)
      {
         printf("%d", pID);
         wait(NULL);
      }
      else
        printf("Failed to create proccess \n");
  </code></pre>
  
  <p>The problem is that no matter what is the command I put in tmp, the program shows me the prompt again, and do nothing except that.
  For example if I write <code>gedit</code> (in order to open the <code>gedit</code> — a ntpad of Ubuntu), it doesn't open it, or if write <code>ls -a</code> it doesn't show me any output as the terminal of Ubuntu does.</p>