CS计算机代考程序代写 file system CSE 2431 Lab 5: UNIX Shell (Part III)

CSE 2431 Lab 5: UNIX Shell (Part III)
Group Size: 1, which means you are required to finish this lab assignment by yourself.
Goal: Getting familiar with UNIX file system operations.
Instruction: The history feature introduced in Lab 3 is not persistent (i.e., the shell program does not maintain the command history across different runs). To make it persistent, you need to modify your shell program to save the contents of the history buffer into a file before it exits. In addition, the shell program needs to reload the previous commands from the saved history file once you start the program. You can name the command history file as .history. For the first time execution of your shell program, the history buffer should be empty and you can create such history file when exiting the program.
Specifically, you need to modify the main() function and possibly other related functions as well in the file shell.c. In the initialization phase, you need to check the existence of the command history file. If it exists, you should open the file and load the command history into the history buffer. Otherwise, you just initialize the history buffer as empty buffer. At the end of the main() function and other possible exit points of the program, you should save the current command history into the history file for future uses.
Note: Name the history file as .history to differentiate your file from others¡¯ files. You can decide the format of the history file as long as it can be reloaded for future program execution.
Submission: Put all your modification in the file shell.c. Submit that file in a .tar.gz or .zip file on Carmen using the commands described for Lab 0. At the beginning of the file shell.c, you need to tell the grader your full name, how to compile your file, and how to run your compiled program. Make sure your instructions work correctly.
Page 1 of 1