Hi,

        I use less to peek into tarballs; and deb files, and so on. I
 am appending my version of the lessopen script (look at
 /usr/bin/lesspipe and /usr/doc/less/LESOPEN.gz). No fuss, no muss,
 and I don't have to learn how to use mc ;-)

        manoj

#!/bin/sh
# Decode directories:
if [ -d "$1" ]; then
    echo "$1:"; ls -als $1
else
    case "$1" in
        *.tar.gz|*.tgz|*.tar.Z)
            tar tzvvf $1 
            zcat $1 
            ;;
        *.Z|*.gz)
            gunzip -c $1
            ;;
        *.bz2)
            bunzip2 -ckd $1
            ;;
        *.bz)
            bunzip -ckd $1
            ;;
        *.tar)
            tar tvf $1 
            cat $1
            ;;
        *.deb)
            echo "$1:"; 
            dpkg --info $1; 
            echo -e '\n*** Contents:'; 
            dpkg-deb --contents $1 
            ;;
        *.zip|*.ZIP)
            if [ -x /usr/bin/unzip ]; then 
                unzip -v $1; 
            else 
                echo "No unzip available"; 
            fi 
            ;;
        *.lzh)
            if [  -x /usr/bin/lha ]; then
                lha v $1;
            else
                echo "No lha available";
            fi
            ;;
        *.rpm)
            if [  -x /usr/bin/rpm ]; then
                echo $1;
                 rpm -q -i -p $1; 
                 echo -e '\n*** Contents:';
                 rpm -q -l -p $1;
            else
                echo "No rpm available";
            fi
            ;;
        *.zoo)
            if [  -x /usr/bin/zoo ]; then
                zoo v $1;
            else
                echo "No zoo available";
            fi
            ;;
        *.arj|*.ARJ)
            if [  -x /usr/bin/unarj ]; then
                unarj -v $1;
            else
                echo "No unarj available";
            fi
            ;;
        *.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
            if [ -x /usr/X11R6/bin/identify ]; then 
                /usr/X11R6/bin/identify $1;
            else 
                echo -e "No identify available
                echo -e Install ImageMagick to browse images"; 
            fi 
            ;;
    esac
fi
-- 
 echo "Hmmm...you don't have Berkeley networking in libc.a..." echo
 "but the Wollongong group seems to have hacked it in." --Larry Wall
 in Configure from the perl distribution
Manoj Srivastava  <[EMAIL PROTECTED]> <http://www.datasync.com/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E


--  
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to