find file type linux script

C++
#! /bin/sh
if [ -f "$1" ] && [ "`file -b --mime-type \"$1\"`" = "image/jpeg" ]; then
    echo "Good type for the file (JPEG)"
fifind . -iname "*.err"
Source

Also in C++: