Question: Copy/Paste your modified script from step 3 here. (The one without the infinite loop.) CIT 130 Lab 14: Scripting part 2 1. This assignment continues
Copy/Paste your modified script from step 3 here. (The one without the infinite loop.)




CIT 130 Lab 14: Scripting part 2 1. This assignment continues on from the work from the last lab. You will only work in Linux in this lab Start your Linux VM, open two terminal windows and cd to /scripts in both code (use i to enter a, in one terminal window type vi script3.sh and enter the following insert mode): /bin/bash Suma for k in se do suma (Sum+k)) done echo he sum of the parameters is ssum Type to exit insert mode, w to save the file and i your other terminal window Sesc remember to change the file's permissions to be executable. Run this script by typing /script3.sh 15 12 20 38 16. What is output? Explain how this script works. Modify script3.sh to compute and output the average of the list of parameters by computing the b. average using Avg r$ ((Sum/$#)). output Avg when done. Run this with the above list of numbers. Does it work? Explain what refers to and how this new instruction works. SH c Run the script from part 2 but with no parameters. What happens? Why? In order to prevent this error, we will use an if then-else statement. Add the statement if -eq 0 J then echo Error cannot compute an average of o numbers else using your previous Avg and echo $Avg instructions from step 1b in place of the Note that you do not have to place this statement on four or more separate lines, it can all go on one line if desired although in this format, it is more readable. Save and run the script with several parameters and again with no parameters. Once it is working correctly, use this final version of the script as your answer to step 3. Explain what the if then-else statement does and why it is good to include it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
