From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Fri, 4 Feb 2005 18:03:37 +0900 From: arisawa@ar.aichi-u.ac.jp To: 9fans@cse.psu.edu Subject: Re: [9fans] netpbm In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 019939a8-ead0-11e9-9d60-3106f5b1d025 Mine is #!/bin/rc -e # unpack file ... # foo.gz -> foo in case of file. # foo.tar.gz -> foo in case of dir. # foo. -> DO NOTHING # foo -> DO NOTHING # # coded by Kenar # fn usage { echo 'usage: unpack file ...' exit usage } fn error { echo $* exit 'not found' } if(~ $#* 0) usage while (! ~ $#* 0 ){ x = $1 if (test ! -e $x) error file $x not found f = 1 while(~ $f 1){ switch($x){ case *.gz gunzip $x x=`{basename $x .gz} case *.tgz gunzip $x x=`{basename $x .tgz}^.tar case *.tar tar -xf $x echo rm $x x=`{basename $x .tar} case *.bz2 bunzip2 $x x=`{basename $x .bz2} case *.tbz bunzip2 $x x=`{basename $x .tbz}^.tar case *.tbz2 bunzip2 $x x=`{basename $x .tbz2}^.tar case * f=0 } } shift } More decoding methods should be added. And I rarely uses execept gzip. Therefore not so much debugged. Kenji Arisawa