summaryrefslogtreecommitdiff
path: root/nocompile/bin/mime-type
blob: 2b1bad0930869a22baeb67f935dc452f86333a23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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?!?" #ssssshhhhh
 TYPE="text/plain" 
fi
if [ "_${MAIN}" = "_text" -a "_${SUB}" != "_html" ];then
 TYPE="text/plain"
fi
printf "%s\r\n" "$TYPE"