License Public Domain
Lines 62
Keywords
decompression (2) gzip (1) tar (1) tcsh (2) Z (1) zip (5)
Permissions
Owner: Jonathan Wong
Viewable by Everyone
Editable by Jonathan Wong
Hide
Don't get spied on – We respect your privacy and provide numerous options to protect it. Join Siafoo Now or Learn More

Multi-extension decompression tool Atom Feed 0

In Brief This tcshell script will allow the user to decompress a given file or a set of files in extensions .tar, .gz, .zip, .Z
# 's
 1#! /bin/tcsh
2
3if ($1 == "") then
4 echo usage: uncomp '{filelist}+'
5endif
6foreach arg ($argv)
7 set zflag = 0
8 set gzflag = 0
9 set zipflag = 0
10 set filename = $arg
11 switch ($arg:e)
12 case Z:
13 set zflag = 1
14 breaksw
15 case gz:
16 set gzflag = 1
17 breaksw
18 case zip:
19 set zipflag = 1
20 breaksw
21 default:
22 endsw
23
24 set file = $arg:r
25 switch ($file:e)
26 case tar:
27 set filename = $arg:r
28 if ($zflag == 1) then
29 tar -Zxf $arg
30 set zflag = 0
31 endif
32 if ($gzflag == 1) then
33 tar -zxf $arg
34 set gzflag = 0
35 endif
36 if ($zipflag == 1) then
37 unzip $arg
38 set zipflag = 0
39 endif
40 breaksw
41 default:
42 endsw
43
44 set file = $arg
45 switch ($file:e)
46 case gz:
47 if ($gzflag == 1) then
48 gzip -d $file
49 endif
50 breaksw
51
52 case Z:
53 if ($gzflag == 1) then
54 uncompress $file
55 endif
56 breaksw
57
58 case zip:
59 unzip $file
60 breaksw
61
62 case tar:
63 tar -xf $file
64 breaksw
65
66 default:
67 echo uncomp: $arg has no compression extension.
68 endsw
69end

This tcshell script will allow the user to decompress a given file or a set of files in extensions .tar, .gz, .zip, .Z