title: Create new commands in terminal with fork() and exec()
body: <p>I would like to know how I can manipulate C program to run command in the terminal.</p>
  
  <p>For example:
  If I run this statement PS1="Linuxrocks $", it runs fine in the terminal.
  But how would I write a program to do the the same thing. Or what function do I use?</p>
  
  <pre><code>    #include &lt;sys/types.h&gt;
      #include &lt;sys/wait.h&gt;
      #include &lt;stdio.h&gt;
      #include &lt;unistd.h&gt;
  
      int main() {
              char *argv[3] = {"Command-line", ".", NULL};
  
              int pid = fork();
  
              if ( pid == 0 ) {
                      execvp( PS1="linuxrocks $", argv );
              }
  
              wait( NULL );
          printf( "Finished executing the parent process\n" );
  
          return 0;
      }
  </code></pre>