On 2013-09-17 20:06, Russell Coker wrote: > ls -l *.mkv *.avi *.mp4 > > The above command will give me errors if I happen to have no .avi files or no > .mkv files. > > How can I write a command to give a list of all video files and not give an > error if some don't exist? Preferably in bash, but I'm willing to try > another > shell if necessary. > > As an aside I'm not actually after running ls, the below is what I'm really > trying to do: > > for n in *.mkv *.avi *.mp4 ; do
You want nullglob: mattcen@isis:tmp$ touch a.mkv b.mp4 mattcen@isis:tmp$ ls *.mkv *.mp4 *.avi ls: cannot access *.avi: No such file or directory a.mkv b.mp4 mattcen@isis:tmp$ shopt -s nullglob mattcen@isis:tmp$ ls *.mkv *.mp4 *.avi a.mkv b.mp4 -- Regards, Matthew Cengia
signature.asc
Description: Digital signature
_______________________________________________ luv-main mailing list [email protected] http://lists.luv.asn.au/listinfo/luv-main
