#!/bin/sh # cmd=$0 usage="Usage: $cmd" tmpf=${TMPDIR:-/tmp}/a2urls$$ trap 'rm -f "$tmpf"' 0 trap 'rm -f "$tmpf"; exit 1' 1 2 13 15 cat >"$tmpf" || exit 1 type=`file2mime "$tmpf"` || exit 1 case "$type" in text/html) urls <"$tmpf" ;; *) grepall -o http: https: ftp: file: <"$tmpf" | tr -s ' \011\015' '\012' | cleanurllist ;; esac