title: C Linux shell - repeat the recent commands
body: <p>I'm trying to implement a linux shell and in this part I'm trying to repeat the recent used commands. Here a sample from the code</p>
  
  <pre><code>if(strcmp(arg[0],"!") == 0 &amp;&amp; arg[1] != NULL){
              if(strcmp(arg[1], "-1") == 0){
                   system("!!");
  
  
              }
  </code></pre>
  
  <p>I want the last command to execute when the user enters "! -1" I tried the system command "!!" but i got an error "command not found". Can you help please?</p>
  
  <p>Thanks in advance</p>