QuestionQuestion

Write, document, and submit a shell script that performs the following steps:

Input 7 numbers in a loop (one at a time for each loop iteration). Validate the input that it is an integer number greater than or equal to 0 using regular expression handling – and prompt the user to re-enter the number if it is not valid.
Make a sum of these numbers that are valid inputs. Count how many of the input numbers that are greater than 250 (i.e., 1-7).
Then output the total sum of these numbers, as well as how many numbers were input that were greater than 250.
Make the shell script executable and output in your submission what command you used to do so.
Run and capture the execution of the script in a screen shot.
In addition to the above steps, make sure you include the following elements:

Use of grep/egrep or other Linux command for input integer validation
Use of conditional logic (e.g., use of do loop).
Use of functions where appropriate
How you made the script executable
Also, answer the question “Within a shell scripting loop construct, what is the difference between the break and continue?

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#!bin/bash

counter=1
sum=0
over250=0

while [ $counter -lt 8 ]

do
echo -n "Enter number "$counter"th: "
read input

positive=` echo $input|egrep '^([1-9])?[0-9]+$'|wc -l `...
$70.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Linux Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats