Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help with this .sh file!!! Never done this before and am extremely confus

ID: 3604526 • Letter: P

Question

Please help with this .sh file!!! Never done this before and am extremely confused. Very much appreciated thank you!!

Part 2 - Linux Shell Scripting - Worth 5 points. NOT using editors, create a sh file named: program2.sh -Set this *.sh file to: chmod 755 *.sh - NOT using editors, append your name, current date and time to a NEW file called results.txt - NOT using editors, append to the *.sh file, all the commands needed so that when you execute your sh file, this file will produce the following: How - Ask the user to enter a number - Verify that the number is between 1 and 100. - If the number is not between 1 and 100, then keep asking the user to enter a number until it is valid - Use a for loop from 1 to the value entered by the user - Sum the results of calculating each number mod 5 After the for loop ends, display the sum of all previous results and append it to the results.txt file as follows Sum of numbers is xxx

Explanation / Answer

#!/bin/sh

echo "Please enter a list of numbers between 1 and 100. "
read NUMBERS

for NUM in $NUMBERS
do
if [ "$NUM" -lt 1 ] || [ "$NUM" -gt 100 ]; then
echo "Invalid Number ($NUM) - Must be between 1 and 100!"
else
echo "$NUM is valid."
fi
done
if (( $num % 5 == 0 ))
then
echo num
fi
ECHO %num% %results.txt%