Complete the code to print numbers from 1 to 5 using a loop.
for i in [1]; do echo $i; done
The loop needs a list of numbers to iterate over. "1 2 3 4 5" correctly provides numbers 1 to 5.
Complete the code to print "Hello" 3 times using a loop.
for i in [1]; do echo Hello; done
The loop needs a list of numbers to repeat the task 3 times. "1 2 3" provides exactly three iterations.
Fix the error in the loop to print numbers 1 to 4.
for i in [1]; do echo $i; done
Bash does not support the '1..4' or 'range()' syntax. "1 2 3 4" is the correct list for the loop.
Fill both blanks to create a loop that prints even numbers from 2 to 10.
for num in [1]; do if [[ $num [2] 2 -eq 0 ]]; then echo $num; fi; done
The loop iterates over even numbers 2 to 10. The condition uses modulus '%' to check if the number is divisible by 2.
Fill all three blanks to create a loop that prints numbers from 1 to 5 squared.
for [1] in [2]; do echo $(( [1] [3] [1] )); done
The variable 'i' iterates over numbers 1 to 5. The expression multiplies 'i' by itself to get the square.