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

Exam 010-160 All Questions

View all questions & answers for the 010-160 exam

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
66cf1d7
6 months, 1 week ago
Selected Answer: E
I tested the script myself. If there were no files named that way it iterates through the literal string *.txt and prints each character.
upvoted 1 times
...
JarnBarn
7 months, 3 weeks ago
The formating of this question is bonkers.
upvoted 2 times
...
Vovanich
1 year, 10 months ago
Selected Answer: E
E. a. txt b. txt
upvoted 2 times
...
linvidia
2 years ago
Selected Answer: E
Output: a.txt b.txt
upvoted 2 times
...
rbishun
2 years, 7 months ago
E is the correct answer - script returns same as: ls *.txt
upvoted 1 times
...
rbishun
2 years, 7 months ago
#!/bin/bash for file in *.txt do echo $file done #Output: *.txt
upvoted 3 times
...
Traian
3 years, 2 months ago
Tested myself. Should be "E" the right answer.
upvoted 2 times
...
quiquisimo
3 years, 6 months 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, 6 months ago
sorry, it's E.
upvoted 6 times
...
...
Nvidia
3 years, 8 months ago
I dont understand this question
upvoted 4 times
IanBilbo12
3 years, 7 months 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, 8 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 ...