Question: I need help writing a method for a unix shell in C. The method is for interactive mode in the shell. In interactive mode, the
I need help writing a method for a unix shell in C.
The method is for interactive mode in the shell. In interactive mode, the shell will display the prompt mysh$ . The users of the shell will type commands after the prompt that will be interpreted by the shell. Unless explicitly indicated by the job separator, the jobs contained in the command are executed sequentially and in the order presented. The prompt is returned when all of the jobs are completed.
---------------------------------------------------------------------------------------
#define PROMPT ("mysh$ ")
int interactive_mode(void) { int i;
do { /* * Print the prompt */ /* * Read stdin, break out of loop if Ctrl-D */
/* Strip off the newline */
/* * Parse and execute the command */
printf("%s ", PROMPT);
} while( 1/* end condition */);
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
