On Thu, Dec 30, 1999 at 01:27:27AM +0000, Adam Sampson wrote:
> (The script's attached; it's a quick wrapper around tar, gzip and bzip2,
> handling multiple archives, letting you do "tart x firstfile.tar.gz
> secondfile.tar thirdfile.tar.bz2" etc.)

D'oh! Forgot to insert the script... here it is.

#!/bin/sh
# tart - an lha-style tar frontend
# Usage: tart [tx] archivefiles ...
# For best effect, "alias x='tart x'; alias t='tart t'" in your sh;
# you can then "x RandomArchive.tar.bz2 somearc.tar.gz"...
# Adam Sampson, [EMAIL PROTECTED]
todo=$1
shift
for x in $* ; do
        prefix=''
        type=`file -b "$x"`
        if echo $type | grep -q "gzip compressed" ; then
                prefix='gunzip |'
                type=`gunzip <"$x" | file -b -`
        fi
        if echo $type | grep -q "bzip2 compressed" ; then
                prefix='bunzip2 |'
                type=`bunzip2 <"$x" | file -b -`
        fi
        if echo $type | grep -q "tar archive" ; then
                archiver='tar'
        fi
        cmd='echo Uh...'
        case $todo in
        t)
                case $archiver in
                tar)
                        cmd='tar tvf -'
                        ;;
                esac
                ;;
        x)
                case $archiver in
                tar)
                        cmd='tar xvf -'
                        ;;
                esac
                ;;
        esac
        eval "cat $x | $prefix $cmd"
done

-- 

Adam Sampson
[EMAIL PROTECTED]

Reply via email to