Skip to content

Instantly share code, notes, and snippets.

@godevnet
Created June 10, 2015 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save godevnet/51ad50a653802c033a99 to your computer and use it in GitHub Desktop.
Save godevnet/51ad50a653802c033a99 to your computer and use it in GitHub Desktop.
Mini-Shell
# include <stdio.h>
# include <unistd.h>
main() {
int status;
char cmd[256],arg[256];
for(;;) {
printf("===> Commande ? "); gets(cmd);
printf("---> Argument ? "); gets(arg);
if ( fork() == 0 ) {
execlp( cmd, cmd, arg, 0 );
} else {
wait(&status);}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment