file -i prints a string like "text/plain; charset=utf-8", while xdg-mime is supposed to return just a MIME type, i.e. "text/plain". file --mime-type prints just the required information. (I'm a maintainer of file, so feel free to ask for clarification of file's operation if you need it.)
Cool, thanks! commit 01b74b7a1bcf4ac84feec89e02a360ce03e2e450 Author: Rex Dieter <rdieter@fedoraproject.org> Date: Wed Jul 13 14:18:08 2011 -0500 * xdg-mime : use 'file --mime-type' instead of 'file -i' (BR39166)
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.