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:mimetypeis provided by the packageperl-file-mimeinfoin arch linux and bylibfile-mimeinfo-perlon debian and ubuntu.