home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1004 < prev    next >
Internet Message Format  |  1990-12-28  |  2KB

  1. From: markk@censor.UUCP (Mark Keating)
  2. Newsgroups: alt.sources
  3. Subject: ztar, shell script for compressed tar archives
  4. Message-ID: <2496@censor.UUCP>
  5. Date: 9 Mar 90 17:04:43 GMT
  6.  
  7.  
  8. I tend to keep a lot of stuff in compressed tar form
  9. and find this utility useful, makes things easier and
  10. does a little checking for dumb mistakes.
  11.  
  12. I find it useful, maybe you will too...
  13.  
  14.  
  15. this is a shell script NOT a shell archive
  16.  
  17. ---------------- cut from here -------------------- 
  18. #!/bin/sh
  19. #
  20. #    ztar function to  read / write / show index  on an archive
  21. #
  22. #        Usage: ztar -[cw] -[xr] -[ti] name
  23. #
  24. #            -[cw] - create or write archive
  25. #            -[xr] - extract or read archive
  26. #            -[ti] - show archive index
  27. #
  28. #            `name'  has `.tar.Z' assumed
  29. #
  30. #                    Mark Keating 1989
  31. #                    markk@censor
  32. #
  33. if test $# -gt 1; then
  34.     BASE=`echo $2 | sed -e 's@.*/@@'` 
  35.     case $1 in
  36.         -[cw])    if test ! -s $BASE; then
  37.                     echo "Directory  \`$BASE'  Not Found"; exit 1;
  38.                 fi
  39.                 if test -s $2.tar.Z ; then
  40.                     echo "File  \`$2.tar.Z'  Already exists"; exit 1;
  41.                 fi
  42.                 tar cvf - $BASE | compress -f >$2.tar.Z ; exit 0;;
  43.         -[xr])  if test -s $BASE; then 
  44.                     echo "Directory  \`$BASE'  Already Exists"; exit 1;
  45.                 fi
  46.                 if test -r $2.tar.Z ; then
  47.                     zcat $2.tar | tar xvfo - ; exit 0;
  48.                 fi
  49.                 echo "File  \`$2.tar.Z'  Not Found"; exit 1;;
  50.         -[ti])    if test -r $2.tar.Z ; then
  51.                     zcat $2.tar | tar tvf - ; exit 0;
  52.                 fi
  53.                 echo "File  \`$2.tar.Z'  Not Found"; exit 1;;
  54.         *)      echo "Error: Unknown Option";;
  55.     esac
  56. fi
  57. #
  58. echo "Usage ztar -[cw] -[xr] -[ti] name[.tar.Z]"
  59. exit 1;
  60. ---------------- cut to here -------------------- 
  61.