title: Multiple execlp not working
body: <p>I need some help here. I need to execute all three execlp() once I run the program but what happen is that only case 0 is executed.I changed pid to 1 and case1 gets executed and so on. Tried putting it in a for loop but does not work. I changed break to continue but still the same - only one process is executed. Any suggestions?</p>
  
  <p>main(){</p>
  
  <pre><code>pid_t pid;
  pid= fork();
  int i;
  
  if(pid==0){
  
      for (i=0; i&lt;3; i++){
          switch (i){
              case 0:
              execlp("/bin/cat", "cat", "wctrial.txt", NULL);
              break;
  
              case 1:     
              execlp("/bin/mkdir", "mkdir", "mydirectory", NULL);
              break;
  
              case 2:
              execlp("/bin/wc", "wctrial.txt", NULL);
              break;
          }
      }
  
  
  }else{
      wait(NULL);
      printf("Child process completed!");
      exit(0);
  }
  </code></pre>
  
  <p>}</p>