home *** CD-ROM | disk | FTP | other *** search
- From: markk@censor.UUCP (Mark Keating)
- Newsgroups: alt.sources
- Subject: ztar, shell script for compressed tar archives
- Message-ID: <2496@censor.UUCP>
- Date: 9 Mar 90 17:04:43 GMT
-
-
- I tend to keep a lot of stuff in compressed tar form
- and find this utility useful, makes things easier and
- does a little checking for dumb mistakes.
-
- I find it useful, maybe you will too...
-
-
- this is a shell script NOT a shell archive
-
- ---------------- cut from here --------------------
- #!/bin/sh
- #
- # ztar function to read / write / show index on an archive
- #
- # Usage: ztar -[cw] -[xr] -[ti] name
- #
- # -[cw] - create or write archive
- # -[xr] - extract or read archive
- # -[ti] - show archive index
- #
- # `name' has `.tar.Z' assumed
- #
- # Mark Keating 1989
- # markk@censor
- #
- if test $# -gt 1; then
- BASE=`echo $2 | sed -e 's@.*/@@'`
- case $1 in
- -[cw]) if test ! -s $BASE; then
- echo "Directory \`$BASE' Not Found"; exit 1;
- fi
- if test -s $2.tar.Z ; then
- echo "File \`$2.tar.Z' Already exists"; exit 1;
- fi
- tar cvf - $BASE | compress -f >$2.tar.Z ; exit 0;;
- -[xr]) if test -s $BASE; then
- echo "Directory \`$BASE' Already Exists"; exit 1;
- fi
- if test -r $2.tar.Z ; then
- zcat $2.tar | tar xvfo - ; exit 0;
- fi
- echo "File \`$2.tar.Z' Not Found"; exit 1;;
- -[ti]) if test -r $2.tar.Z ; then
- zcat $2.tar | tar tvf - ; exit 0;
- fi
- echo "File \`$2.tar.Z' Not Found"; exit 1;;
- *) echo "Error: Unknown Option";;
- esac
- fi
- #
- echo "Usage ztar -[cw] -[xr] -[ti] name[.tar.Z]"
- exit 1;
- ---------------- cut to here --------------------
-