Skip to content

Instantly share code, notes, and snippets.

@alecbz
Created September 25, 2013 00:47
Show Gist options
  • Save alecbz/6693523 to your computer and use it in GitHub Desktop.
Save alecbz/6693523 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <unistd.h>
int main() {
pid_t pid = fork();
if (pid == 0) {
printf("I'm the child -- about to run ls -a -l\n");
execlp("ls", "ls", "-a", "-l", (char*)NULL);
} else {
printf("I'm the parent -- about to run pwd\n");
execlp("pwd", "pwd", (char*)NULL);
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment