Question
Create a shell in C language 1) Create an argument tokenizer then write a main() function that prints a prompt inputed by user, accepts input,
Create a shell in C language
1) Create an argument tokenizer then write a main() function that prints a prompt inputed by user, accepts input, and tokenizes the input.
2) Use the argument vector to an executeCmd() function with int executeCmd(char **args);
3) The function should return a -1 if an error, or a zero otherwise. Inputing an x in the prompter will exit the program.
4) Write an executeCmd() function that can execute any program in the background and redirect the output of any program to a file. Any number of functions can be executed in executeCmd() such as listing the files in the current directory, listing files in long format or displaying current working directory (ls, ls -a, pwd).
5) The program should run in the background working on the function, but the prompt should be available to take new requests ($ cat prog.c &).
6) Function execBackground() should be used to determine when a job should run in the background. The function will strip the & character from the argument vector. This function will also let the output of a running program to be redirected to a file ($ grep if prog.c > foo).
7) The maker should include two source files and one header file as well as a makefile. The main() function, the executeCmd() function and all supporting functions will be in a file program_exec.c and the function prototype for executeCmd() program_exec.h.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started