Created
September 25, 2013 00:47
-
-
Save alecbz/6693523 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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