#include #include #include main() { int pid; printf("Single\n"); pid = fork(); if (pid < 0) { perror("fork failed"); exit(-1); } else if (pid == 0) /* child */ { printf(" Child Process\n"); printf(" Executing ls using execl ...\n"); execl("/bin/ls", "ls", "-lt", (char *) 0); /* If execl returns, the call has failed */ perror("execl failed to run ls"); exit(-1); } else /* parent */ { wait( (int *)0 ); /* wait to avoid child zombie */ printf("Parent Process\n"); printf("--my child has completed the ls\n"); exit(0); } }