QuestionQ46

VerifiedThe Power of the Command Line

A directory contains these files:

Question Image

What is the output of this shell script?

for file in *.txt  
  
![Question Image](https://cdn.examcademy.com/images/questions/1783953040384-jcoprpda.png)  
Explanation

In a POSIX shell, pathname expansion of *.txt selects the matching files a.txt and b.txt. The for loop iterates over those names, so echo $file outputs a.txt and then b.txt, each on its own line.

Community Discussion

No comments yet. Be the first to start the discussion!