Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a shell program called myshell that must provide services to support the following commands and features: a. (5 marks) STOP: Terminates execution of the

image text in transcribed

Write a shell program called myshell that must provide services to support the following commands and features: a. (5 marks) STOP: Terminates execution of the current myshell session. b. (5 marks) SETSHELLNAME : Sets the shell name in the myshell 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. (5 marks) SETTERMINATOR : Sets the terminator in the myshell command prompt to . If no terminator is defined, myshell should use > as the default terminator. d. (10 marks) NEWNAME | : Manages the alias 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, and 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. (10 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. (10 marks) SAVENEWNAMES : Stores all currently defined aliases in the file g. (10 marks) READNEWNAMES : Reads all aliases in the file and adds them to the aliases defined in the current session. If a duplicate is found in the file , it should be ignored. h. (5 marks) : Executes the UNIX command , corresponding to any valid UNIX command. One approach to implementing this is to use the system function. If the first token on a command line is not a built-in command, assume that it is a UNIX command. i. (5 marks) HELP: shows all built-in commands supported by myshell. j. (10 marks) Error handling: Your approach should effectively identify and recover from errors. For example, bad input and/or the inability to execute a command should not cause myshell to crash. Write a shell program called myshell that must provide services to support the following commands and features: a. (5 marks) STOP: Terminates execution of the current myshell session. b. (5 marks) SETSHELLNAME : Sets the shell name in the myshell 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. (5 marks) SETTERMINATOR : Sets the terminator in the myshell command prompt to . If no terminator is defined, myshell should use > as the default terminator. d. (10 marks) NEWNAME | : Manages the alias 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, and 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. (10 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. (10 marks) SAVENEWNAMES : Stores all currently defined aliases in the file g. (10 marks) READNEWNAMES : Reads all aliases in the file and adds them to the aliases defined in the current session. If a duplicate is found in the file , it should be ignored. h. (5 marks) : Executes the UNIX command , corresponding to any valid UNIX command. One approach to implementing this is to use the system function. If the first token on a command line is not a built-in command, assume that it is a UNIX command. i. (5 marks) HELP: shows all built-in commands supported by myshell. j. (10 marks) Error handling: Your approach should effectively identify and recover from errors. For example, bad input and/or the inability to execute a command should not cause myshell to crash

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions