#!/bin/sh if [ -z "$1" ] then >&2 echo "webmime: no argument given" exit 2 fi URL="$(echo "$1" | grep -i ^http)" if [ -z "$URL" ] then >&2 echo "webmime: argument is not a http url ($1)" exit 1 fi >&2 echo "webmime: reading content-type from: $1" R="$(curl --connect-timeout 5 -sI "$URL" | grep -i "^content-type:" | tr -d ' ' | awk -F'[:;]' '{ print $2 }')" if [ -z "$R" ] then >&2 echo "webmime: no content-type header found ($1)" exit 1 fi echo "$R"