c code輔導

CSCI212 assignment3 solution: shell interpreter implementation

 

CSCI212/MCS9212

Assignment 3 (7.5 marks)

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写Due 11:59pm Sunday May 17, 2015.

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写The aim of this assignment is to write a simple shell interpreter demonstrating you knowledge of process

control. In addition to this you will get some experience with file system API’s.

Task One (4.5 marks)

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写You first task is to write a simple shell interpreter, which executes commands. You shell interpreter should

display a $ prompt and wait for user input.

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写You shell interpreter is to be a little simplistic, all you can do is execute commands. If a command cannot be

全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写found you should display a suitable error message. When executing a command the shell interpreter should

wait until the command terminates. To implement command execution simply use the function call fork()

and exec(). Note that there are many variations on the exec() function call. To block the shell, you

should use the wait() (or similar) function call.

At the end of this step you should be able to do this:

$ ./foobar

./foobar does not exist.

$ ls