Question 1
Which of the following examples shows the general structure of a for loop in a shell script?
Answer and explanation
Correct answer: C
The correct syntax for a for loop in shell scripting uses the format 'for variable in list; do commands; done'. This structure includes the loop variable (file), the list to iterate over (*.txt), the do keyword to start the command block, and done to end the loop. The other options show incorrect syntax: using => instead of do, parentheses instead of do/done, exec which is for find command, and foreach which is not valid shell syntax.