101-400 Exam QuestionsBrowse all questions from this exam

101-400 Exam - Question 86


Which of the following examples for Bash file globbing matches a file named root-can-do-this.txt when used in the directory holding that file? (Choose three correct answers.)

Show Answer
Correct Answer: ABC

To match the file named root-can-do-this.txt in the specified directory using Bash globbing, we need to closely examine each pattern. Option A (root*can?do-this.{txt,odt}) will match the file because it uses an asterisk (*) to match any characters between 'root' and 'can' and a question mark (?) to match any single character between 'can' and 'do-this'. Option B (r[oOoO]t-can-do*.txt) will match as it uses a character class [oOoO] to match 'o' or 'O' in 'root' and an asterisk (*) to match any characters after 'do-', and ends with .txt which matches the file extension. Option C ({root,user,admin}-can-??-this.txt) matches as it uses brace expansion to match 'root', 'user', or 'admin', and double question marks (??) to match any two characters between 'can-' and 'this'. Other options contain patterns that do not correctly match the entire filename as specified.

Discussion

3 comments
Sign in to comment
deewetdvjbmnjkjytfdszxcOptions: ACE
Jul 25, 2020

Is A+C+E

DenisZOptions: ACE
Jul 10, 2021

Yes, you're right ACE

nathaninoOptions: ACE
May 11, 2022

Indded! ACE