Using command line options in bash shell script

Assignment Help Data Structure & Algorithms
Reference no: EM1380517

Design a script that will permit the user to enter one of several choices from the command line. The specific requirements are as follows:

[A] Copy one file to another. The user enters the source and destination file to copy to and from. The script shall handle the following cases:
a. Source file name specified does not exist. Script shall display an error message and terminate. Optionally, the script can display an error message and prompt the user to specify the source file name to copy from.
b. Source and destination files both exist. Script shall prompt for permission to overwrite the destination file. If permission is denied, program will display message and terminate.
c. Source file specified with no destination file specified. Script shall display error message and terminate or optionally, it can prompt the user to enter the file name to copy to.

[B] Remove a file if it exists. The user provides the name of the file to remove or delete. Display a message indicating success or failure back to the user and terminates. The script shall handle the following conditions:
a. If the user enters the remove file option but no file name specified the script shall display an error message and terminate or, optionally, display an error message and prompt the user for the file name to remove and remove the file if it exists.
b. If the specified file does not exist the script shall display an error message and terminate.

[C] Display the current day of the week. The script shall allow the user an option to display the day of the week.

[D] Display the month's calendar. The script shall allow the user an option to display the month's calendar.

[E] The script should be named commands.sh and accept options in the command line as either -r or -R for removing a file, -c or -C for copying a file, -d or –D to display the day of the week and –m or –M to display the month's calendar.

[D] If the user enters command.sh without any options the script shall display the usage examples as shown below.

[E] The script shall include the option and the necessary positional parameters information to perform the options as follows:

Copy a file:
prompt$ ./commands.sh –c sourceFile destinationFile
prompt$ ./commands.sh –C sourceFile destinationFile

Remove a file:
prompt$ ./commands.sh –r fileName
prompt$ ./commands.sh –r filename

Display day of week:
prompt$ ./commands.sh –d
prompt$ ./commands.sh –D

Display month's calendar:
prompt$ ./commands.sh –m
prompt$ ./commands.sh –M

 

Reference no: EM1380517

Questions Cloud

How you plan to revise also proofread your final paper : In case of a resume, a single error can put you out of competition. Question - Briefly illustrate conference explain how you plan to revise also proofread your final paper.
What is the foundation of ecuador''s comparative advantage : What is the foundation of Ecuador's comparative advantage in the production of roses? Most Ecuadorean roses are traded in the United States or Europe
Illustrate what result for thomas : Thomas's house is set on fire also burns to ground. Owners of massage parlour also Thomas sue Ralph for negligence.Illustrate what result for massage parlour.
Discuss characteristics of each segmentation strategy : Discuss characteristics of each segmentation strategy; synthesize characteristics also assess explain how an organization determines which one (or more) of strategies to implement.
Using command line options in bash shell script : Design a script that will permit the user to enter one of several choices from the command line. The specific requirements are as follows:
The worlds poorest nations are at a competitive disadvantage : The world's poorest nations are at a competitive disadvantage in every sector of their economies. They have slight to export.
Explain how can content of consumer blogs affect companies : Explain how can content of consumer blogs affect companies. Explain how might blogging by employees adversely affect a company. An employee.
One estimate proposes that if food prices rise : One estimate proposes that if food prices rise by one third they will decrease living standards in rich countries by about three percent however in very poor ones by about twenty percent
Decide whether silas should recover in this case : closing also he sued 18 is enough for damages. 18 is enough defended on basis of limitation of liability provision on parking stub also notice that lot closed at 8:00. Using principles of bailment law, decide whether Silas should recover in this c..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Dbms and data mining to imporve customer service

Discuss how a database management system and data mining can help motor vehicle maintenance center improve its services, and what tables would be required in such a database.

  Data structures for a single algorithm

Data structures for a single algorithm

  Clerical office placement setting

Determine what other databases would be known to benefit a clerical or job placement organization using databases?

  Find the checksum field in a single parity bit scheme

Assume that the information content of a packet is the bit pattern 1111000010100101 and an even parity is being used

  Describe and implement fft algorithm cooley-tukey

Describe and implement in C++ FFT algorithm "Cooley-Tukey". Also, implement naive DFT and compare naive DFT with FFT using: a sample of the signal x(t) = t

  Create a flowchart to determine the cause of problems

Assume you are the 1st level help desk technician at a average sized corporations. Your job is to handle the initial calls from corporation  computer users with personal computer related problems.

  Explaining diffie-hellman public-key algorithm

Use the Diffie-Hellman public-key algorithm to exchange secret keys.

  What are entity-relationship diagrams

What are entity-relationship diagrams, and how are they used? Discuss the ethical issues to consider when planning a database.

  Design a representation of display screen

Create a form that lists possible potatoes and toppings in a manner that is easy for counter servers and kitchen crew to scan, and can also be used as input for the inventory reorder system.

  What is minimum number of nodes expanded for bfs and dfs

Consider the following graph representing the state space and operators of a navigation problem: What is the minimum number of nodes expanded and the storage needed for BFS and DFS?

  Question about binomial tree

A binomial tree of height O, Bo is a one node tree. A binomial tree of height k, Bk is formed through attaching a binomial tree, Bk-1 to root of another binomial tree another binomial tree Bk-1.

  Entity relationship diagrams

Discuss why are Entity Relationship Diagrams an important initial stage in developing databases? Who would be the initial parties interacting to develop the ERDs?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd