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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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