I am writing a bash script, that needs to check the different mime-types of different files. The files should support rdf4j REST API (http://docs.rdf4j.org/rest-api/#_content_types).
Normally, using file --mime-type <file>
provides the correct mime type. However, when running on a .ttl file, it returns wrong:
foo.ttl: text/plain
instead of text/turtle
Does it exist a better way to solve this, then checking every file-ending, for each file?
You can use an alternative to
file
, for instancemimetype
.At least the following example file from the wikipedia entry on .ttl is recognized as
text/turtle
:mimetype
is provided by the packageperl-file-mimeinfo
in arch linux and bylibfile-mimeinfo-perl
on debian and ubuntu.