There are three files in a directory:
ab2 ab23 ab3
When I execute:
ls ab+(2|3)
It displays:
ab2 ab23 ab3
instead of ab2 and ab3 only.
Any ideas why it is like that? Is it a bug?
There are three files in a directory:
ab2 ab23 ab3
When I execute:
ls ab+(2|3)
It displays:
ab2 ab23 ab3
instead of ab2 and ab3 only.
Any ideas why it is like that? Is it a bug?
Copyright © 2021 Jogjafile Inc.
It's not a bug.
+(pattern)matches one or more occurrences of the pattern.+(2|3)will match any combination and any number of2's and3's:2,3,23,32,222,333,3223232323—any of those.If you want strict alternation without repeats, change
+to@:(Or just use
ab[23]. That doesn't even requireextglob.)