#!/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, azz@gnu.org todo=$1 shift for x in $* ; do prefix='' type=`file "$x"` if echo $type | grep -q "gzip compressed" ; then prefix='gunzip |' type=`gunzip <"$x" | file -` fi if echo $type | grep -q "compress'd data" ; then prefix='uncompress |' type=`uncompress <"$x" | file -` fi if echo $type | grep -q "bzip2 compressed" ; then prefix='bunzip2 |' type=`bunzip2 <"$x" | file -` 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