#!/bin/sh TYPE="$(file -b --mime-type $1)" MAIN="$(echo "${TYPE}" | cut -d/ -f1)" SUB="$(echo "${TYPE}" | cut -d/ -f2)" if [ "_${MAIN}" = "_inode" ];then printf "text/plain\r\n" printf "this is a directory or symlink! wtf?!?" TYPE="text/plain" fi if [ "_${MAIN}" = "_text" -a "_${SUB}" != "_html"];then TYPE="text/plain" fi printf "%s\r\n" "$TYPE"