|
|
|
|
|
by e12e
4421 days ago
|
|
Right. It's not entirely straight forward to link up the mime database (via eg: file) and generating filters for use by find. Basing filters off of filenames isn't a very good idea -- and actually a little regressive in my opinion -- after all project/bin/foo (executable) might be a python or perl or whatever script -- not just a binary file. But first getting all files via find, then testing with file, and finally matching against mime-type doesn't sound like something that's going to be as fast as possible... I tried to see if maybe gvfs (gio - gnome io) could help, but couldn't really find anything directly applicable (although there is a set of gvfs command line tools, like gvfs-ls, gvfs-info, gvfs-mime). |
|
That's one of the big features of ack that the find/grep combo can't replicate is checking the shebang of the file to detect type. In ack's case, Perl and shell programs are detected both by extension:
And by checking the shebang: Run `ack --dump` to see a list of all the definitions.