#!/bin/sh -e FILE="$1" && shift CMD= TYPE=`/usr/bin/file -bL -- "$FILE"` case $TYPE in bzip\ compressed*|bzip2\ compressed*) CMD='/bin/bzcat -q --' ;; gzip\ compressed*) CMD='/bin/zcat -q --' ;; compress\'d\ data*) CMD='/usr/bin/uncompress -c' ;; esac if [ -n "$CMD" ]; then CMD2= TYPE=`$CMD "$FILE" 2>/dev/null |/usr/bin/file -b -` case $TYPE in *tar\ archive*) CMD2='/bin/tar -tvv' ;; *cpio\ archive*) CMD2='/bin/cpio -tv' ;; ELF\ *|*\ ELF\ *) CMD2='/usr/bin/readelf' ;; Linux/i386*|MS-DOS\ executable*|MS-Windows*|Win95\ executable*) CMD2='/usr/bin/strings' ;; *troff\ or\ preprocessor\ input\ text*) CMD2='/usr/bin/nroff -t -mandoc' ;; esac if [ -z "$CMD2" ]; then exec $CMD "$FILE" 2>&1 else $CMD "$FILE" 2>&1 |$CMD2 2>&1 exit fi fi case $TYPE in *tar\ archive*) CMD='/bin/tar -tvf' ;; *cpio\ archive*) CMD='/bin/cpio -tv --quiet -I' ;; Zip*) CMD='/usr/bin/unzip -l -qq --' ;; Zoo*) CMD='/usr/bin/zoo xqp' ;; ARC*) CMD='/usr/bin/arc pn' ;; LHa*) CMD='/usr/bin/lha p' ;; RAR*) CMD='/usr/bin/unrar p' ;; RPM\ v*) CMD='/bin/rpm -qilvp --' ;; current\ ar\ archive*) CMD='/usr/bin/ar tv' ;; ELF\ *|*\ ELF\ *) CMD='/usr/bin/readelf -a --' ;; Linux/i386*|MS-DOS\ executable*|MS-Windows*|Win95\ executable*) CMD='/usr/bin/strings --' ;; *troff\ or\ preprocessor\ input\ text*) CMD='/usr/bin/nroff -t -mandoc --' ;; esac if [ -n "$CMD" ]; then exec $CMD "$FILE" 2>&1 fi