Bird
0
0

If the directory contains files: img01.png, img02.png, img10.png, which files match the pattern img[0-1]?.png?

medium📝 Command Output Q5 of 15
Linux CLI - File and Directory Operations
If the directory contains files: img01.png, img02.png, img10.png, which files match the pattern img[0-1]?.png?
Aimg01.png, img02.png, img10.png
Bimg01.png, img10.png
Cimg01.png only
Dimg02.png only
Step-by-Step Solution
Solution:
  1. Step 1: Understand character range [0-1]

    This matches one character that is 0 or 1.
  2. Step 2: Analyze pattern img[0-1]?.png

    The first wildcard matches 0 or 1, the second ? matches any one character.
  3. Step 3: Check files

    img01.png matches ('0' in [0-1], '1' by ?), img02.png matches ('0' in [0-1], '2' by ?), img10.png matches ('1' in [0-1], '0' by ?). All match.
  4. Final Answer:

    img01.png, img02.png, img10.png -> Option A
  5. Quick Check:

    Ranges in [] match only specified characters [OK]
Quick Trick: Use [0-9] to match digits, ranges are inclusive [OK]
Common Mistakes:
  • Assuming [0-1] matches digits 0 to 10
  • Confusing ? with * wildcard
  • Ignoring order of characters in pattern

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes