Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 010-160 topic 1 question 22 discussion

Actual exam question from LPI's 010-160
Question #: 22
Topic #: 1
[All 010-160 Questions]

A directory contains the following files:

What would be the output of the following shell script?
for file in *.txt

  • A. *.txt
  • B. a b
  • C. c.cav
  • D. a.txt
  • E. a. txt b. txt
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
JarnBarn
1 month, 1 week ago
The formating of this question is bonkers.
upvoted 1 times
...
Vovanich
1 year, 4 months ago
Selected Answer: E
E. a. txt b. txt
upvoted 2 times
...
linvidia
1 year, 5 months ago
Selected Answer: E
Output: a.txt b.txt
upvoted 2 times
...
rbishun
2 years ago
E is the correct answer - script returns same as: ls *.txt
upvoted 1 times
...
rbishun
2 years ago
#!/bin/bash for file in *.txt do echo $file done #Output: *.txt
upvoted 2 times
...
Traian
2 years, 8 months ago
Tested myself. Should be "E" the right answer.
upvoted 2 times
...
quiquisimo
3 years ago
i think it's A because * is a meta-character, so the "for" will search for every pattern that ends with .txt
upvoted 2 times
quiquisimo
3 years ago
sorry, it's E.
upvoted 6 times
...
...
Nvidia
3 years, 1 month ago
I dont understand this question
upvoted 3 times
IanBilbo12
3 years, 1 month ago
I believe the shell script calls to echo out the files. However, .cav IS NOT a valid file format, so it doesn't get called??? Anyone who knows for real, please chime in.
upvoted 3 times
NivC
2 years, 2 months ago
It is about the wildcard * which means that all files that end with ".txt" are valid, will show in the output the full file name.
upvoted 3 times
...
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...