Write a shell script that takes an unspecified number of command line arguments (up to nine) of integers and find their sum.
Answers
Answer:
sum=0
for i in $@; do sum=$((sum+i)); done
echo $sum
exit 0
Explanation:
This script will take variable arguments ans return the result
Concept:-
It might resemble a word or a number representation of the quantity's arithmetic value. It could resemble a word or a number that represents the numerical value of the quantity. It could have the appearance of a word or a number that denotes the quantity's numerical value.
Given:-
Given that "write a shell script that takes an unspecified number of command line arguments (up to nine) of integers and find their sum."
Find:-
We need to find that "write a shell script that takes an unspecified number of command line arguments (up to nine) of integers and find their sum."
Solution:-
sum
for in do sum done
echo sum
exit
Hence, this script will take variable arguments ans return the result.
#SPJ3