问题
I want to match all filenames in a directory that are like this:
h1.txt, h2.txt, h12.txt, h3.txt
If I do
echo h[[:digit:]].txt
I get
h1.txt, h2.txt, h3.txt
so it matches all the files I want, except h12.txt
, because it has two digits instead of one. Is there an expansion for one or more digits?
回答1:
Figured it out!
echo h+([[:digit:]]).txt
来源:https://stackoverflow.com/questions/35433926/bash-bracket-expansion-how-to-match-all-files-names-with-a-number