Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created September 7, 2025 09:55
Show Gist options
  • Select an option

  • Save jacobsapps/4a92f38037f329fdc64ec15e4b5a3baf to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/4a92f38037f329fdc64ec15e4b5a3baf to your computer and use it in GitHub Desktop.
while (true) {
char* command = read_input();
pid_t pid = fork();
if (pid == 0) {
exec(command); // execute child process
} else {
wait(pid); // parent waits for child to finish
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment