Complete the code to create an infinite loop using while.
while [1]; do echo "Looping forever" done
The true command always returns success, so the while loop never ends.
Complete the code to create an infinite loop using for.
for (( [1] )); do echo "Looping forever" done
In bash, for ((;;)) creates an infinite loop by omitting all three expressions.
Fix the error in the infinite loop condition.
while [ [1] ]; do echo "Looping forever" done
In bash test brackets, use -eq for numeric equality, so [ 1 -eq 1 ] is correct.
Fill both blanks to create an infinite loop with a condition that always succeeds.
while [1] [2]; do echo "Still looping" done
Using true && keeps the condition always true, so the loop never ends.
Complete the code to create an infinite loop using a for loop with arithmetic syntax.
for (( ; [1]; )); do echo "Loop forever" done
In bash, for (( ; true; )) creates an infinite loop by leaving init and increment empty and condition true.
