#include #include #include #include #include int main(int argc, char * argv[]) { pid_t pid; pid = fork(); if(pid < 0) { perror("Fork failed"); exit(-1); } if (pid == 0) /* child */ { printf("I am the child\n"); printf("-------------------------------------\n"); execlp("/bin/ls","ls","-al",NULL); printf("-------------------------------------\n"); } else { wait(NULL); printf("-------------------------------------\n"); printf("Child complete\n"); exit(0); } }