Recall & Review
beginner
What does the wildcard * mean in file globbing?
The * wildcard matches zero or more characters in file names. For example, *.txt matches all files ending with .txt.
Click to reveal answer
beginner
How does the ? wildcard work in file globbing?
The ? wildcard matches exactly one character. For example, file?.txt matches file1.txt or fileA.txt but not file12.txt.
Click to reveal answer
beginner
What is the purpose of square brackets [] in file globbing?
Square brackets [] match any one character inside them. For example, file[123].txt matches file1.txt, file2.txt, or file3.txt.
Click to reveal answer
beginner
How would you match all files starting with 'data' and ending with '.csv' using globbing?
Use the pattern data*.csv. The * matches any characters between 'data' and '.csv'.
Click to reveal answer
intermediate
What does the pattern file[!a-c].txt match?
It matches files named file followed by any single character except 'a', 'b', or 'c', then .txt. For example, filed.txt matches but filea.txt does not.
Click to reveal answer
Which wildcard matches exactly one character?
✗ Incorrect
The ? wildcard matches exactly one character in file names.
What does the pattern *.sh match?
✗ Incorrect
*.sh matches any file name that ends with .sh.
How do you match files named file1.txt, file2.txt, or file3.txt but not file4.txt?
✗ Incorrect
file[123].txt matches files with one character from 1, 2, or 3 after 'file'.
What does the pattern file[!a-c].txt do?
✗ Incorrect
The ! inside [] negates the set, so it matches any character except a, b, or c.
Which pattern matches all files starting with 'log' and ending with any single character?
✗ Incorrect
log? matches files starting with 'log' followed by exactly one character.
Explain how the wildcards *, ?, and [] work in file globbing with examples.
Think about how you find files by patterns in a folder.
You got /4 concepts.
Describe how to exclude certain characters using file globbing patterns.
It's like saying 'match anything except these letters'.
You got /3 concepts.