Question: PART 1 Implementing myshell and Capturing Result 40 points Your shell program must provide services to support the following commands and features: 1 Note: The


PART 1 Implementing myshell and Capturing Result 40 points Your shell program must provide services to support the following commands and features: 1 Note: The commands are shown in uppercase font, but don't have to be programmed that way. The parameters to the commands are enclosed between the symbols and , but the symbols are not actually part of the parameters. a. (3 marks) STOP: Terminates execution of the current myshell session. b. (3 marks) SETSHELLNAME : Sets the shell name in the myshe 11 command prompt to . For example, a sample command prompt is shown below: myshell> In this command prompt, there are two parts. The first part, myshell, is the shell name. The second part, >, is the terminator. If no shell name is defined, myshell should be the default shell name. c. (3 marks) SETTERMINATOR > : Sets the terminator in the myshell command prompt to terminator >. If no terminator is defined, myshell should use > as the default terminator. list. The first option deletes a previously defined alias. The second option defines an alias for another command. For example, the command NEWNAME mymove deletes the alias for mymove, the command NEWNAME mycopy cp defines mycopy as the alias for the cp command. If an alias for a command already exists, then the new alias replaces the old alias. The maximum number of aliases in the alias list should be set to 10 as the default. e. (6 marks) LISTNEWNAMES: Outputs all the aliases that have been defined. Each pair of names should be shown on one line. For example, the possible aliases for a few commands are shown below: mycd cd mycopy cp f. (6 marks) SAVENEWNAMES : Stores all currently defined aliases in the file file_name >. g. (5 marks) READNEWNAMES file_name > : Reads all aliases in the file file_name . h. (2 marks) UNLX command : Executes the UNIX command UNLXcommand , corresponding to any valid UNIX command. If the first token on a command line is not a built-in command, assume that it is a UNIX command. i. (2 marks) HELP: shows all built-in commands supported by myshell. Note: You must handle all the built-in commands with exactly the same syntax as shown above. Thus, an important part of the myshe 11 program will be to parse commands entered at the command prompt to break them down into their component parts. Once a command has been parsed, the component parts can be checked to ensure that a valid command has been entered and that it adheres to the required syntax. For this problem, the results are worth 40 marks out of the 50 marks available. The breakdown of these marks is shown above. Demonstrate that your shell works and that it can handle all of the requirements described above. Your demonstration should be captured in a script log file and follow the sequence of commands given below: HELP 1s1 SETSHELLNAME mysh SETTERMINATOR \$ NEWNAME myhelp help NEWNAME MYCOPY cp NEWNAME mycat cat NEWNAME mydel rm SAVENEWNAMES myaliases.txt LISTNEWNAMES mycat myaliases.txt mycopy myaliases.txt myfile mycat myfile cat myfile 1s LISTNEWNAMES READNEWNAMES myaliases.txt STOP PART 1 Implementing myshell and Capturing Result 40 points Your shell program must provide services to support the following commands and features: 1 Note: The commands are shown in uppercase font, but don't have to be programmed that way. The parameters to the commands are enclosed between the symbols and , but the symbols are not actually part of the parameters. a. (3 marks) STOP: Terminates execution of the current myshell session. b. (3 marks) SETSHELLNAME : Sets the shell name in the myshe 11 command prompt to . For example, a sample command prompt is shown below: myshell> In this command prompt, there are two parts. The first part, myshell, is the shell name. The second part, >, is the terminator. If no shell name is defined, myshell should be the default shell name. c. (3 marks) SETTERMINATOR > : Sets the terminator in the myshell command prompt to terminator >. If no terminator is defined, myshell should use > as the default terminator. list. The first option deletes a previously defined alias. The second option defines an alias for another command. For example, the command NEWNAME mymove deletes the alias for mymove, the command NEWNAME mycopy cp defines mycopy as the alias for the cp command. If an alias for a command already exists, then the new alias replaces the old alias. The maximum number of aliases in the alias list should be set to 10 as the default. e. (6 marks) LISTNEWNAMES: Outputs all the aliases that have been defined. Each pair of names should be shown on one line. For example, the possible aliases for a few commands are shown below: mycd cd mycopy cp f. (6 marks) SAVENEWNAMES : Stores all currently defined aliases in the file file_name >. g. (5 marks) READNEWNAMES file_name > : Reads all aliases in the file file_name . h. (2 marks) UNLX command : Executes the UNIX command UNLXcommand , corresponding to any valid UNIX command. If the first token on a command line is not a built-in command, assume that it is a UNIX command. i. (2 marks) HELP: shows all built-in commands supported by myshell. Note: You must handle all the built-in commands with exactly the same syntax as shown above. Thus, an important part of the myshe 11 program will be to parse commands entered at the command prompt to break them down into their component parts. Once a command has been parsed, the component parts can be checked to ensure that a valid command has been entered and that it adheres to the required syntax. For this problem, the results are worth 40 marks out of the 50 marks available. The breakdown of these marks is shown above. Demonstrate that your shell works and that it can handle all of the requirements described above. Your demonstration should be captured in a script log file and follow the sequence of commands given below: HELP 1s1 SETSHELLNAME mysh SETTERMINATOR \$ NEWNAME myhelp help NEWNAME MYCOPY cp NEWNAME mycat cat NEWNAME mydel rm SAVENEWNAMES myaliases.txt LISTNEWNAMES mycat myaliases.txt mycopy myaliases.txt myfile mycat myfile cat myfile 1s LISTNEWNAMES READNEWNAMES myaliases.txt STOP
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
