Bash Pattern Matching Syntax
Michał Masłowski
mtmi at o2.pl
Sun Oct 23 05:43:23 PDT 2005
> I want to list the files in a directory that end in ".jpg" irregardless
> of case. Thus after reading the bash man page, it seems I should be
> able to issue a command something along the lines of "ls [*.[JjPpGg]]"
> or "ls *.[JjPpGg]" but neither of these work and return a "No such file
> or directory" message. I've also tried various ways of escaping the
> '*' and '." but that didn't help either. However "ls *[JjPpGg]" does
> work by listing the files. However I want to match the "." before "jpg"
> as well. What is the correct syntax for what I'm trying to do?
>
> Thanks,
>
> Drew
ls *.{JPG,jpg}
or
ls *.{J,j}{P,p}{G,g}
More information about the freebsd-questions
mailing list