#!/bin/sh # /usr/local/bin/smartercat # http://crystalfaeries.net/posix/bin/smartercat # celeste:crystalfaery 2015-05-03 02:19:28+00:00 # from Linux Journal 2009 April issue 180 page 14 while [ $# -ne 0 ] do echo "BEGIN== $1 ==BEGIN" >&2 case `file -b $1 | cut -d' ' -f1` in Zip|gzip) CAT=zcat ;; bzip2) CAT=bzcat ;; *) CAT=cat ;; esac $CAT $1 echo "EOF==== $1 ====EOF" >&2 shift done