#!/bin/csh set noclobber set compress = compress set extn = Z foreach f ( $argv ) if ( "$f" == '-gnu' ) then set compress = ( gzip -best ) set extn = gz continue endif if ( -e $f ) then set ocd = "$cwd" set ncd = "$f:h" if ( "$ncd" == "$f:t" ) set ncd = "$cwd" if ( "$ncd" == "" ) set ncd = "$cwd" cd $ncd echo "" echo "Creating file $cwd/$f:t.tar.${extn}:" tar cvf - $f:t | $compress > $f:t.tar.$extn set s = $status if ( $s == 0 ) then echo "File $cwd/$f:t.tar.$extn complete" else if ( $s == 2 ) then echo "File $cwd/$f:t.tar.$extn complete" echo " - NB compress output bigger than tar source" else echo "Error in making $cwd/$f:t.tar.${extn}: quitting" exit $s endif cd $ocd endif end