So I\'ve got the following files in the tmp directory:
file.0
file.1
file.t9
file.22
file.4444
if I wanted to list only the files that
At least in bash 4, when the extglob
shell option is enabled:
shopt -s extglob
ls /tmp/file.+([0-9])
The pattern +([0-9])
there matches one or more digits.
You can read more about this in the Pattern Matching section of man bash
.
UPDATE
Actually, as @chepner pointed out, since extglob
was introduced in version 2.02, this should work in pretty much every bash
you come across today, unless you pulled your distro out of a rock or something.