-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2005-10-15 15:25 -0700, [EMAIL PROTECTED] wrote:
> 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.  What is the correct syntax for what I'm trying to do?

ls *.[jJ][pP][gG]

Each [] group matches a single character, so "ls *.[JjPpGg]" is "list
all files that end in a period followed by one of J, j, P, p, G or g".
Character ordering is irrelevant.

Alternatively, you could do:

ls | grep -i '.jpg$'

Or:

find . -maxdepth 1 -iname '*.jpg'

The find or ls-pipe-grep versions get a LOT cleaner when you have many
known characters with unknown case in the file name, but don't work if
you need to discriminate based on case for some characters and not by
others.

- -- 
Michael Kjörling, [EMAIL PROTECTED] - http://michael.kjorling.com/
* ASCII Ribbon Campaign: Against HTML Mail, Proprietary Attachments *
* ..... No bird soars too high if he soars with his own wings ..... *
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDUYTjdY+HSb3praYRAulaAJ9P1LDLFnmu33HTTHFeXZwAGrAwRACfTmGF
8rnOP4hrj6gFZaoaArSqwjo=
=LuDd
-----END PGP SIGNATURE-----
-- 
gentoo-user@gentoo.org mailing list

Reply via email to