#include <stdio.h>
#include <unistd.h>

int main(int argc, char* argv[])
{
  pid_t pid_sh;
  int statut_sh;

  switch(pid_sh=fork()){
  case -1 : perror("Fork");
    return -1;
  case 0 : /* execution de la commande  par un sous-shell */
    execlp("sh","sh", "-c",argv[1], NULL);
    perror("execlp");
    exit(-1);
  default : waitpid(pid_sh, &statut_sh,0);
    return statut_sh;
  }
}
