Line | |
---|
1 | #!/bin/sh
|
---|
2 |
|
---|
3 | if test $# = 0; then
|
---|
4 | echo 'zfile: file(1) for programs which may be compressed with gzexe'
|
---|
5 | echo usage: `basename $0` files...
|
---|
6 | exit 1
|
---|
7 | fi
|
---|
8 |
|
---|
9 | tmp=/tmp/gz$$
|
---|
10 |
|
---|
11 | for i do
|
---|
12 | if test ! -f "$i" ; then
|
---|
13 | echo `basename $0`: $i not a file
|
---|
14 | res=1
|
---|
15 | continue
|
---|
16 | fi
|
---|
17 | skip=18
|
---|
18 | if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then
|
---|
19 | eval `sed -e 1d -e 2q "$i"`
|
---|
20 | fi
|
---|
21 | if tail +$skip "$i" | gzip --list >/dev/null 2>&1; then
|
---|
22 | tail +$skip "$i" | gzip -cd | dd count=1 >$tmp 2>/dev/null
|
---|
23 | file $tmp | sed "s|^$tmp|$i|"
|
---|
24 | else
|
---|
25 | file "$i"
|
---|
26 | fi
|
---|
27 | rm -f $tmp
|
---|
28 | done
|
---|
Note:
See
TracBrowser
for help on using the repository browser.