Write a shell script called :addall: that takes a list of integers as command li
ID: 660360 • Letter: W
Question
Explanation / Answer
#! /bin/sh
total=0 # this is to store total of all numbers
count=0
for element in "$@" # fetching al numbers from list to add
do
total=`expr $total + $element`
count=$count+1
done
printf "The sum of the given %s numbers is : %s" $count,$total #printing total
$ watch tail -n $1 logfile.txt #printing lines from history as per user wish
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.