#include #include #include int main() { int pid,status; char comd[20];pid=fork(); if(pid==0) { printf("child process\n"); while(strcmp(comd,"exit")!=0) { printf("[user@localhost~]$"); gets(comd); system(comd); } exit(0); } else { wait(&status); printf("parent process\n"); } }
**************************************** OUTPUT: Child process [user @ localhost ~]$ exit Parent process [student @ localhost ~]$ ****************************************