Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write two bash shell scripts that convert between month names and numbers. Both scripts should perform error-checking on the command-line information. Ensure that: - If

Write two bash shell scripts that convert between month names and numbers. Both scripts should perform error-checking on the command-line information. Ensure that: - If more or less than exactly one single command-line parameter is used, a usage error message is displayed. - If the provided input is not part of the scripts expected input, a different, specific error message should be displayed. i. The first script should be called 05-month-num. It should do the following: 1. Receive a month name as a parameter through the command line. The month name should be accepted in 2 formats: Full name (January, February, etc), or 1st 3-Letter abbreviation (Jan, Feb, Mar, Nov, Dec, etc). Be sure to note the capitalization of the input. 2. Use the bash case construct to determine and display the number of the month provided. (Jan => 1, February => 2, March => 3, Apr => 4) ii. The second script should be called 05-month-name and it should do the following: 1. Receive a number from 1-12 as a parameter through the command line. 2. Use the bash if/elif construct to display the full name of the corresponding month (1=>January, 2=>February, , 12=>December) See the following example runs for clarification on how this should work and how the output and error checking should look:

$ 05-month-num

#incorrect input (number of parameters) USAGE: 05-month-num Ex: 05-month-num Nov

$ 05-month-name

#incorrect input (number of parameters) USAGE: 05-month-name Ex: 05-month-name 11 $

05-month-name 11

#correct input The name of month 11 is November.

$ 05-month-num November

#correct input The month number for November is 11.

$ 05-month-num Nov

#correct input The month number for Nov is 11.

$ 05-month-name 42

#incorrect input (outside of range) Bad month number. must be an integer in the range 1-12.

$05-month-num april

#incorrect input (outside of range) Bad month name. must be one of the following: January, February, March, April, May, June, July, August, September, October, November, or December, or the first 3 characters of any of these names (Ex: Nov).

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

Why are disruptive technologies tricky?

Answered: 1 week ago

Question

Define Synchro Marketing.

Answered: 1 week ago

Question

Define marketing concepts.

Answered: 1 week ago

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago