Assignment #1 Note: Do not implement the loop until you have one instruction working correctly. Note: Do not crash or hinder the server. In this assignment you will be building your own shell. You should already be familiar with fork, waitpid, exec, and exit system calls. If you need to look something up related to these calls then use man. Examples: "man 2 fork", "man 2 waitpid", "man 3 execlp", "man 2 exit". In this assignment your shell will accept commands from standard in. The user will type a string onto the command line prompt. You will read in this string using getline. getline will read in a whole line of input. You can see a reference of this function at: http://www.cplusplus.com/reference/string/getline/ After a getline, you will need to break the string up into pieces for use in the exec command. If the last character is an & then that character is deleted although you should note it as you will use it later. A good description (and even good code that is usable) is available at: http://www.linuxselfhelp.com/HOWTO/C++Programming-HOWTO-7.html You're looking for something to "tokenize" the string into individual pieces or tokens. (Section 7.3) After reading in a line and breaking it into pieces, you will fork a child and execute the instruction with the arguments listed by the user. If there was no & the parent process will wait until the child exits and then will post a prompt for the next instruction. This should be done in a loop until exit is typed on the command line. If ctrl-c is hit, handle this signal, print a goodbye message and then exit the shell. If there was an &, then the parent process will immediately not wait on the child to finish executing. If the command does not exist or exec fails in some way, report an error to the user and continue by posting a prompt for the next instruction. You may find that this method really lends itself to execvp instead of execlp because you have a list of arguments of undetermined size at start. Given that you'll likely end up with a vector of strings from the tokenizer above, you will need to convert this into an array of c-style strings for use in execvp. You may use this method to achieve the correct array for execvp: char ** toArray(const vector & tokens) { char ** res; res = new char *[tokens.size() + 1]; for(int i = 0; i < tokens.size(); i++) { res[i] = new char[tokens[i].length() + 1]; strcpy(res[i], tokens[i].c_str()); } res[tokens.size()] = NULL; return res; } You would use the result of this function as the second argument to execvp. Make sure that you correctly exit programs on failed exec. Also, you should use ps to check for any unusual issues regarding background processes or exiting programs. Lastly, it is a good idea to clean up whenever you have issues by using the kill command. Remember kill -9 -1 should kill everything associated with you. Do not allow a fork to execute in a loop! You may experiment, but not maliciously. This can affect your grade, especially if you prevent your classmates from accessing and utilizing the server.