Question
A simple shell is a basic shell program that supports commands with I/O re-direction. Once, a user enters a command string (ended with a return
A simple shell is a basic shell program that supports commands with I/O re-direction. Once, a user enters a command string (ended with a return key), your program should parse the command line and determines whether it contains I/O redirection signified by > for output to a file or < for input from a file. The program has also 3 built-in commands that cd, pwd, and exit. The built-in functions are not executed by forking and executing an executable. Instead, the shell process executes them itself. All other command must be executed in a child process. To implement the cd command, your shell should get the value of its current working directory (cwd) by calling getcwd() on start-up. When the user enters the cd command, you must change the current working directory by calling chdir(). What to Hand in Submit a tar file using the following command %tar cvf p1.tar README typescript your_codes #*.c *.C *.h Makefile To extract you can use tar xvf p1.tar 1. A README file with: 1. Your name and your partner's name 2. If you have not fully implemented all shell functionality then list the parts that work (and how to test them if it is not obvious) so that you can be sure to receive credit for the parts you do have working. 2. All the source files needed to compile, run and test your code (Makefile, .c or c++ files, optional test scripts). Do not submit object or executable files. 3. Output from your testing of your shell program. Make sure to demonstrate: 1. simple Unix commands 2. built-in commands 3. I/O redirection 4. error conditions You can capture the screen output of shell program using script > script Script started, file is typescript % ./myshell myshell % ls foo.txt myshell myshell % exit good bye % exit exit
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