Linux Essentials (010-160) — Question 31

Which of the following examples shows the general structure of a for loop in a shell script?

Answer options

Correct answer: C

Explanation

Option C is correct because it accurately represents the syntax of a for loop in a shell script, using 'for file in *.txt' followed by the commands to execute. The other options either use incorrect syntax or are not valid constructs in a shell script context.