Which wildcards will match the following filenames? (Choose two.) ttyS0 ttyS1 ttyS2
A. ttyS[1-5]
B. tty?[0-5]
C. tty*2
D. tty[A-Z][012]
E. tty[Ss][02]
Which wildcards will match the following filenames? (Choose two.) ttyS0 ttyS1 ttyS2
A. ttyS[1-5]
B. tty?[0-5]
C. tty*2
D. tty[A-Z][012]
E. tty[Ss][02]
The correct answer is A,D
[1-5] is not matched to ttyS0
so answer is B,D
Answer A cannot be correct because the value 0 in brackets is not taken into account.
# touch ttyS0 && touch ttyS1 && touch ttyS2 && ls
ttyS0 ttyS1 ttyS2
# ls ttyS[1-5] && ls tty?[0-5] && ls tty*2 && ls tty[A-Z][012] && ls tty[Ss][02]
ttyS1 ttyS2
ttyS0 ttyS1 ttyS2
ttyS2
ttyS0 ttyS1 ttyS2
ttyS0 ttyS2
Definitely B and D.