Question: ( 3 0 Points ) Write a complete bash script called euidA. sh ( where euid is your EUID ) : Define a function called
Points Write 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 commandline arguments while
the second parameter is the number of integers passed in to the bash script.
If the number of parameters passed into the function is equal to compute the
average using the two parameters 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 floatingpoint accurate average.
In the main part of the bash script:
If one or more integers are passed in to the bash script, you will
initialize two variables sum and count to
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 are integers.
Otherwise, 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 oneline gawk command such that if the minutes portion of the time from
the date command written to the date.txt filc is less than 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 charactersbytes contained in the file to the terminal. Hint: There is a
Linux 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 :: CST
$matAsh
minutes past the hour
date.txt
$ date This command only used to show time for understanding purposes only.
Sun Feb :: CST
$matAsh
date.txt
$matsh
The average of numbers is
$ matsh
The average of numbers is
$ matsh
The average of numbers is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
