From: Dave Pearson Date: Thu, 26 Jun 1997 15:59:07 +0100 I've attached the file (bash script) as mutt.octet.filter. The entry that uses it is in my ~/.mutt_mailcap and reads: application/octet-stream; mutt.octet.filter %s | vcat -s; copiousoutput (vcat is a simple cat utility that strips out non-printable stuff). My mailcap path is "~/.mutt_mailcap:/usr/local/etc/mailcap". #!/usr/local/bin/bash function ShowTAR() { tar tvvf "$1" 2> /dev/null } function ShowTGZ() { tar tzvvf "$1" 2> /dev/null } function ShowGZIP() { gzip -dc "$1" 2> /dev/null } function ShowZIP() { unzip -l "$1" 2> /dev/null } function ShowARJ() { unarj l "$1" 2> /dev/null } function ShowEXE() { echo "$(basename "$1"): DOS/Windows executable" } function Showdata() { echo "$(basename "$1"): unprintable data" } function ShowMISC() { FILE_TYPE=$(file -z "$1" 2> /dev/null) if [ $? -gt 0 ] then FILE_TYPE=$(file "$1" 2> /dev/null) fi FILE_TYPE=$(echo "$FILE_TYPE" | cut -d' ' -f 2-) # echo "'$(basename $1)' appears to be of the type:" # echo $FILE_TYPE # echo case "$FILE_TYPE" in *tar*archive*gzip* ) ShowTGZ "$1";; *tar*archive* ) ShowTAR "$1";; *gzip* ) ShowGZIP "$1";; *ARJ*archive*data* ) ShowARJ "$1.";; # "." gets round bug in unarj. *zip*archive*file* ) ShowZIP "$1";; *DOS*executable* ) ShowEXE "$1";; data ) Showdata "$1";; * ) cat "$1";; esac } if [ "$1" = "" ] then echo "syntax: $(basename '$0') [file]" else case "$1" in *.tar ) ShowTAR "$1";; *.tgz ) ShowTGZ "$1";; *.tar.gz ) ShowTGZ "$1";; *.tar.Z ) ShowTGZ "$1";; *.tar.z ) ShowTGZ "$1";; *.Z ) ShowGZIP "$1";; *.z ) ShowGZIP "$1";; *.gz ) ShowGZIP "$1";; *.zip ) ShowZIP "$1";; *.ZIP ) ShowZIP "$1";; *.arj ) ShowARJ "$1";; *.ARJ ) ShowARJ "$1";; * ) ShowMISC "$1";; esac fi