What would be the output of the shell script that echoes all .txt files in the current directory?

Prepare for the LPI Linux Essentials 010-160 Test. Study with flashcards and multiple choice questions, each question offers hints and explanations. Get ready to ace your exam!

The script is designed to list all files with the .txt extension in the current directory. When executed, it scans the directory for files that match the pattern specified (i.e., files that end in .txt).

If there are multiple files like 'a.txt' and 'b.txt', they would both be echoed in the output. The use of a comma to separate the filenames in the output suggests that the script is concatenating the results of the matching .txt files into a single line.

Thus, if 'a.txt' and 'b.txt' are present in the current directory and are the only files with that extension, the output would correctly be 'a.txt, b.txt', consolidating all found matches in the specified format. This aligns with standard shell behavior for file matching in a directory using patterns.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy