The following shell script is used to check if the numbers f
The following shell script is used to check if the numbers from command line are even or odd./bin/bash count = 0 for $num in {$@} do If [expr $num % 2 == 0] then echo $num is an even number count = \'expr $count+ 1\' else echo $num is an odd number fi echo There are $count even numbers in total. Which line(s) is(are) incorrect? And how to correct it(them)? Please write down your solution for that line (those lines).
Solution
line number Errors correct version
-------------------------------------------------------------------
4 $num num
6 == -eq
6 no quotes in expr \'expr $num % 2 -eq 0\'
8 no quotes in echo \"$num is an even number\"
9 spaces in expr count = \'expr $count + 1\'
11 no quotes in echo \"$num is an odd number\"
13 no end for do done
15 no quotes in echo \"There are $count even numbers in total\"
![The following shell script is used to check if the numbers from command line are even or odd./bin/bash count = 0 for $num in {$@} do If [expr $num % 2 == 0] th The following shell script is used to check if the numbers from command line are even or odd./bin/bash count = 0 for $num in {$@} do If [expr $num % 2 == 0] th](/WebImages/23/the-following-shell-script-is-used-to-check-if-the-numbers-f-1055956-1761550902-0.webp)