Develop a shell script called addRange.bash that gets two numbers as arguments a
ID: 3631563 • Letter: D
Question
Develop a shell script called addRange.bash that gets two numbers as arguments and determines sum of all numbers between the ranges of the two arguments (including input arguments). In the script, you have to check if the first argument is less than or equal to the second argument.The following is the sample run of your script:
$ ./addRange.bash 1 3
The sum is 6.
This is another sample run:
$ ./addRange.bash 5 5
The sum is 5.
This is another sample run:
$ ./addRange.bash 12 10
Invalid arguments.
Explanation / Answer
#!/bin/bash if [ $1 -le $2 ] then sum=0 for((i=$1;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.