Code:#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <fcntl.h> #include <time.h> #include <sys/param.h> char history[100][100]; int historyCount = 1; char background[100][100]; char globalCommand[100]; int main(int argc, char *argv[]) { while (1) { pid_t childPid; int status; char * cmdLine=malloc(100); char * path=malloc(100); char * execCommand=malloc(100); path = printPrompt(); printf("%s# ",path); cmdLine = readCommandLine(); //if( isBuiltInCommand(cmdLine, path) == 1) { if (strcmp("exit", cmdLine) == 0) { exit(8); } else //executeBuiltInCommand(cmdLine, path); } else { execCommand = cmdLine; printf("%s\n", execCommand); childPid = fork(); //if (childPid == 0) { //if (execlp (globalCommand, globalCommand,(char*)0) == -1) // perror("exec"); printf("%s\n",execCommand); } if (childPid < 0) { perror ("fork"); return 0; } //if (childPid == 0) //{ //if (execlp ("ps", "ps",(char*)0) == -1) // perror("exec"); //exit(127); //printf("childPid %i\n", childPid); //} /* Have the parent wait for child to complete */ else { //if (runInForeground(cmdLine)) { if (wait (&status) < 0) perror ("wait"); } /*else { //record list of background jobs } */ } } } return EXIT_SUCCESS; }