Question: Create a basic shell program in C called wish to pass the following test cases. Be sure to use execv ( ) instead of execvp

Create a basic shell program in C called wish to pass the following test cases. Be sure to use execv() instead of execvp(). Do not hard code paths. /bin/ls should come from a search from paths. The same goes for the testing folder. There should be a main.c, common.c, and common.h.
The following are the tests to pass.
Test 1:
1.desc - Input to check bad od. No arguments are passed to cd.
1.err - An error has occurred
1.in - cd
exit
1.out -
Test 2:
2.desc -2 arguments are passed to cd.
2.err - An error has occurred
2.in - cd /bad1/bad2
exit
2.out -
Test 3:
3.desc - Is with a bad directory name.
3.err -Is: /no/such/file: No such file or directory
3.in - Is /no/such/file
exit
3.out -
Test 4:
4.desc - Input to run misc. commands.
4.err -
4.in - cd tests/p2a-test
Is
4.out - test1
test2
test3
test4
Test 5:
5.desc - Tries to exit with an argument. Should throw an error.
5.err - An error has occurred
5.in - exit bad
exit
5.out -
Test 6:
6.desc - Try running a shell script without setting path.
6.err - An error has occurred
6.in - p1.sh
exit
6.out -
Test 7:
7.desc - Set path, run a shell script. Overwrite path and then try running the script again.
7.err - An error has occurred
An error has occurred
7.in - path tests
p1.sh
path
p1.sh
Is
exit
7.out - test1
test2
test 3
test4
 Create a basic shell program in C called wish to pass

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!