Question: (100 points) Create a shell from scratch which can read scripts. Code this in C/C++. Should be able to do the following commands: echo prints

(100 points) Create a shell from scratch which can read scripts. Code this in C/C++. Should be able to do the following commands:

echo prints out text

echo $? prints out exit code of previous command

!! repeates last command given to shell

exit exits shell with a given code 0-255, and number larger should be trunckated. This can be done either by using the exit() system call or return from the main function the exit code

Other details:

  • When no other command listed is used the Shell will print out "Incorrect command"
  • When the user gives an empty command, the shell gives a new prompt.
  • At minnimum should be able to run the program below
## run.sh echo run echo running echo ran !! exit 10
$ ./myShell test.sh run running ran ran $ echo $? 10 $

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!