Question
((Procedure: These steps assume you are using the Ubuntu Linux. Shell Scripts as wrappers for Linux Commands A wrapper is typically a function that is
((Procedure: These steps assume you are using the Ubuntu Linux. Shell Scripts as wrappers for Linux Commands A wrapper is typically a function that is used to provide a simpler interface to another function. In this problem you will develop bash shell scripts that use the standard Linux commands to provide the user with a simple means to access the underlying functionality available in Linux. For directories with a large number of files, it is sometimes helpful to be able to list the contents based on some category of the files. Three obvious categories are: 1) directories 2) ordinary, executable files (these would be scripts or binary code) 3) ordinary, non-executable files (these would typically be text files, either data or source code))
The Linux date command provides extensive functionality beyond simply providing today's date and time, but requires detail knowledge of its various options. For example date -d "Mar 9 2016" +%A This shell script will provide a simple user interface to use date for a specific purpose. Write a shell script with the following specifications name of script: whichday purpose: displays the day of the week on which a particular date falls, for example, bash whichday Mar 9 2017 Then the result should be Thursday If the command line arguments are less than 3 or more than 3, your script should write to stdout a display asking for the correct arguments Please enter month day year (example: Jan 5 2002) and try again If the command line arguments are 3, your script will write to stdout the day of the week based on the input. You may wonder what if your input is not the correct date format? Don't worry, date command takes care of it. b) Write the whichday script as a bash shell script, test it, and then save it in your ee462 directory in AFS as whichday Once you have whichday working, then you should write whichyears. It should operate in a similar way as whichday; that is, if the number of arguments is not 3, it displays a message showing what the arguments should be. With command line arguments similar to whichday, it finds all of the years starting from the year entered, in which the specified date falls on the same day of the week as it did in the given year. For example, if you enter: bash whichyears Apr 5 1991 it will display: Apr 5 1991 Friday Apr 5 1996 Friday Apr 5 2002 Friday Apr 5 2013 Friday These are the years from 1991 in which April 5 falls on the same day as it did in 1991 (Friday). This script simply searches all the way to the current year (2018), looking for a year in which the given date falls on the same day as the given date fell in the given year Then you may ask what ifI input a future date, like April 5 2028, then you will simply search from the current year (2018) all the way to 2028. it will display: Apr 5 2023 wednesday Apr 5 2028 wednesday Hint: date +Y will give you the current year, save it to a variable and construct a for loop Write the whichyears script, test it, and then save it in your ee462 directory in AFS as whichyears. c) The Linux date command provides extensive functionality beyond simply providing today's date and time, but requires detail knowledge of its various options. For example date -d "Mar 9 2016" +%A This shell script will provide a simple user interface to use date for a specific purpose. Write a shell script with the following specifications name of script: whichday purpose: displays the day of the week on which a particular date falls, for example, bash whichday Mar 9 2017 Then the result should be Thursday If the command line arguments are less than 3 or more than 3, your script should write to stdout a display asking for the correct arguments Please enter month day year (example: Jan 5 2002) and try again If the command line arguments are 3, your script will write to stdout the day of the week based on the input. You may wonder what if your input is not the correct date format? Don't worry, date command takes care of it. b) Write the whichday script as a bash shell script, test it, and then save it in your ee462 directory in AFS as whichday Once you have whichday working, then you should write whichyears. It should operate in a similar way as whichday; that is, if the number of arguments is not 3, it displays a message showing what the arguments should be. With command line arguments similar to whichday, it finds all of the years starting from the year entered, in which the specified date falls on the same day of the week as it did in the given year. For example, if you enter: bash whichyears Apr 5 1991 it will display: Apr 5 1991 Friday Apr 5 1996 Friday Apr 5 2002 Friday Apr 5 2013 Friday These are the years from 1991 in which April 5 falls on the same day as it did in 1991 (Friday). This script simply searches all the way to the current year (2018), looking for a year in which the given date falls on the same day as the given date fell in the given year Then you may ask what ifI input a future date, like April 5 2028, then you will simply search from the current year (2018) all the way to 2028. it will display: Apr 5 2023 wednesday Apr 5 2028 wednesday Hint: date +Y will give you the current year, save it to a variable and construct a for loop Write the whichyears script, test it, and then save it in your ee462 directory in AFS as whichyears. c)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started