Beginner Linux & Shell Scripting
Q28 / 100

What is the purpose of a "for" loop in a shell script?

Correct! Well done.

Incorrect.

The correct answer is B) To repeat a block of commands for each item in a list or range of values

B

Correct Answer

To repeat a block of commands for each item in a list or range of values

Explanation

A "for" loop (e.g. "for i in 1 2 3; do echo $i; done") iterates over a sequence of values, executing the loop body once for each item.

Progress
28/100