summaryrefslogtreecommitdiff
path: root/nocompile/bin/mime-type
diff options
context:
space:
mode:
Diffstat (limited to 'nocompile/bin/mime-type')
-rwxr-xr-xnocompile/bin/mime-type13
1 files changed, 13 insertions, 0 deletions
diff --git a/nocompile/bin/mime-type b/nocompile/bin/mime-type
new file mode 100755
index 0000000..71982d9
--- /dev/null
+++ b/nocompile/bin/mime-type
@@ -0,0 +1,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?!?"
+ TYPE="text/plain"
+fi
+if [ "_${MAIN}" = "_text" -a "_${SUB}" != "_html"];then
+ TYPE="text/plain"
+fi
+printf "%s\r\n" "$TYPE"