Bird
0
0

You have files: img01.png, img02.png, img10.png, img20.png. Which pattern matches only files with numbers from 01 to 09?

hard📝 Application Q15 of 15
Linux CLI - File and Directory Operations
You have files: img01.png, img02.png, img10.png, img20.png. Which pattern matches only files with numbers from 01 to 09?
A<code>img0[1-9].png</code>
B<code>img[0-9][1-9].png</code>
C<code>img??.png</code>
D<code>img[01-09].png</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand pattern img0[1-9].png

    This matches 'img0' plus one digit from 1 to 9, then '.png'. So it matches 'img01.png' to 'img09.png'.
  2. Step 2: Check other patterns

    img[0-9][1-9].png matches any two digits, including 'img10.png' and 'img20.png'. img??.png matches any two characters after 'img', so all files. img[01-09].png is invalid syntax because ranges like '01-09' are not valid inside [].
  3. Final Answer:

    img0[1-9].png -> Option A
  4. Quick Check:

    Use 0 then [1-9] for numbers 01-09 [OK]
Quick Trick: Use fixed digit then range in [] for number ranges [OK]
Common Mistakes:
  • Using invalid range syntax inside []
  • Using ?? which matches any two characters
  • Not fixing leading zero for 01-09

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes