Prev: Can I test for the existence of a filetype when I don't know any filenames?
Next: Simple Hack To Get $2000 To Your PayPal Account
From: Ben Bacarisse on 12 Jul 2010 20:54 Lao Ming <laomingliu(a)gmail.com> writes: > I want to list all the images in a directory but no other files. If I > try e.g.: > > ls -al *.jpg *.png *.gif > > I can get a failure if there is, e.g. no GIF. Does *.{jpg,png,gif} meet your needs? It, too, fails if there is no match but this might be a good thing. <snip> -- Ben.
From: Ben Bacarisse on 13 Jul 2010 07:05
Janis Papanagnou <janis_papanagnou(a)hotmail.com> writes: > On 13/07/10 02:54, Ben Bacarisse wrote: >> Lao Ming <laomingliu(a)gmail.com> writes: <snip> >>> I can get a failure if there is, e.g. no GIF. >> >> Does *.{jpg,png,gif} meet your needs? It, too, fails if there is no >> match but this might be a good thing. > > But that way you get exactly the same error message as with the OP's > command, and the OP explicitly said he wants to avoid the error > message. Ha! So it does. I wonder where I got the idea that it did not? I think it would be better if the shell behaved as I have imagined it, but that does not change the fact that at least some do not. Thanks for spotting that. -- Ben. |