title: basic CLI program in C
body: <p>Okay so overall im trying to complete a basic CLI C program which will complete functions such as clear, quit, cd, ls, help (bring up the unix man) etc.. i altered my code and so far i have this, im getting segmination error when trying to execute the cd command part of the program, (im very new to c btw); </p>
  
  <pre><code>    #include&lt;stdio.h&gt;
      #include&lt;stdlib.h&gt;
      #include&lt;string.h&gt;
      #include&lt;unistd.h&gt;
  
      int main (int argc, char *argv[])
      {
        char input[] = " ";
        char *argument;
       while(strcmp(input, "quit")!= 0)
        {
  
  
        printf("$");
        scanf ("%s", input);
  
       if(strcmp(input,"clear") == 0)
       {
         printf("\e[1;1H\e[2J");
        }
  
      else if(strcmp(argv[1],"cd") == 0)
       {
  
  
        if(chdir(argv[2]) == -1)
        {
           printf("\n directory does not exists");
         }
  
       }
  
  
  
      else if(strcmp(input, "echo") == 0)
       {
      char str[50];
      scanf("%[^\n]+", str);
  
      printf(" %s", str);
       }
  
  
  
  
  
    }
  
   }
  </code></pre>