Question: I. (30 Points) W'rite a complete bash script called euidA.sh (where euid is your EUID): Define a function called average that accepts two parameters: the

I. (30 Points) W'rite a complete bash script called euidA.sh (where "euid" is your EUID): Define a function called average that accepts two parameters: the first parameter is the sum of all the integers passed in to the bash script (as command-line arguments), while the second parameter is the number of integers passed in to the bash script. o If the number of parameters passed into the function is equal to 2, compute the average using the two paramcters passed to the function, and then print out a meaningful message that includes the number of integers passed in to the bash script and the integer average of those integers. Note that this only asks for an "integer average", not a floating-point accurate average. In the main part of the bash script: o If one or more integers are passed in to the bash script, you will initialize two variables sum and count to 0, use a loop to keep a running sum and count of the integers passed in to the bash script, and call the function average, passing sum and count as parameters to the function. Note that you may assume that if the user passes any parameters to the bash script that they arc integers " o Othcrwise, if no integers are passed to the bash script, you will redirect the output of the Linux date command to a file called date.txt, write a one-line gawk command such that if the minutes portion of the time from the date command (written to the date.txt filc) is less than 30 minutes, you will print out the minutes followed by the text "minutes past the hour", and " if the date.txt file is readable by the process, then output the number of lines, words and characters/bytes contaned in the file to the terminal. Hint: There is a Limcx command that does this very easily. Please put your name in comments in the program file, but due to time constraints, other comments are not required in this script file SAMPLE OUTPUT (user input in bold): date (This command only used to show time for understanding purposes only.) Sun Feb 24 18:16:29 CST 2019 s ./mat0299A. sh 16 minutes past the hour 1 6 29 date.txt s date (This command only used to show time for understanding purposes only.) Sun Feb 24 18:33:48 CST 2019 $/mat0299A.sh 1 6 29 date.txt s /mat0299.sh 5 The average of 1 numbers is 5 $ /mat0299.sh 5 10 The average of 2 numbers is7 ./mat0299.sh 5 10 15 20 25 The average of 5 numbers is 15
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
