Which wildcards will match the following filenames? (Choose two.) ttyS0 ttyS1 ttyS2
Which wildcards will match the following filenames? (Choose two.) ttyS0 ttyS1 ttyS2
To match the filenames ttyS0, ttyS1, and ttyS2, wildcards must cover the patterns in these filenames. The pattern tty?[0-5] matches all given filenames because the question mark matches any single character and the range [0-5] allows for numbers 0 through 5. The pattern tty[Ss][02] also matches the filenames because it explicitly includes 'S' or 's' followed by either 0 or 2. Other options like ttyS[1-5] exclude 0, tty*2 is too broad, and tty[A-Z][012] is invalid for this scenario, as it includes uppercase letters other than 'S' and 's'.
B and D are correct. A doesn't include 0, C is definitely wrong and E doesn't include 1.
[root@centos7 ~]# touch ttyS0 ttyS1 ttyS2 [root@centos7 ~]# [root@centos7 ~]# [root@centos7 ~]# [root@centos7 ~]# ls tty?[0-5] ttyS0 ttyS1 ttyS2 [root@centos7 ~]# ls tty[AZ][012] ls: cannot access tty[AZ][012]: No such file or directory
you forgot the - in the [A-Z]
well, if i do ls /dev/tty?[0-5] on debian/centos i get 28 results including e.g. /dev/ttyS63 so suffice it to say i am a bit confuseled.... (yet i found the same answer in another language test with the same answers)
For this one, tty?[0-5], question mark represents if the proceeding character is present or not. So I think the answer is correct if ttyS?[0-5] was an option
We're talking about wildcars (globbing) not regular expressions.
A, B, and D is the answer. They all can match the files
A. ttyS[1-5] A will not work because it is missing a 0 in the [1-5]. If it was ttyS[0-5], then the answer would be valid.
A can not be considered because the endings are : 012 So the correct ans are B, D
Answer: BD