title: cd command not working with execvp
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
      char *ip;
      char *temp[10];
      pid_t pid;
  
      pid = fork();
  
      if (pid == 0) {
          int i = 0;
  
          do {
              gets(ip);
  
              temp[0] = strtok(ip, " ");
              while (temp[++i] != NULL) {
                  temp[i] = strtok(NULL," ");
              }
  
              pid_t pid2;
  
              pid2 = fork();
              if (pid2 == 0) {
                  execvp(temp[0], temp);
              }
          } while(strcmp(temp[0], "quit"));
  
          if (!strcmp(temp[0],"quit")) {
              return;
          }
      } else if (pid &lt; 0) {
          fprintf(stderr,"error in creating child");
      } else if (pid &gt; 0) {
          wait(NULL);
      }
  }
  </code></pre>
  
  <p>this code doesnt seem to work with cd command.how do i go about fixing it?i am fairly new to the concepts of OS and any help would be appreciated! :)</p>