On 25 Jan 1999, in message <[EMAIL PROTECTED]>
CDitty <[EMAIL PROTECTED]> wrote:
| I have
| installed RH and have a basic understanding for Xwindows and Linux itself.
| However, I recently d/led a few programs that have tgz and gz extensions on
| them.
| Can someone point me in the right direction to uncompress and to install
| these programs?
Someone else has already mentioned gunzip, compress, bunzip2 and tar. I
append "t" (aka "x"), a script I use for this. It figures out what sort
of file it is (from the name, so make sure the name it right) and
either lists or extracts it. Install in in your path (eg $HOME/bin as
"t" and hard link it to "x"). I just type
t thing.tgz
to list the contents and
x thing.tgz
to extract it, for all sorts of archive types. Saves all that typing.
--
Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/
#!/bin/sh
#
# TOC or extract various archive formats.
# - Cameron Simpson <[EMAIL PROTECTED]>
#
# Iterative analysis of extensions; the combinations were getting too many.
# - cameron 22jan99
#
cmd=`basename "$0"`
case "$cmd" in
t) mode=toc ;;
x) mode=extract ;;
*) echo "$cmd: who am I? I expected to be \"t\" or \"x\"" >&2
exit 1
;;
esac
toc_cpio='cpio -icvt' extract_cpio='cpio -icvdm'
toc_tar='tar tvf -' extract_tar='tar xvf -'
toc_uu="egrep '^(begin|end) '" extract_uu='uudecode /dev/fd/0'
toc_lzh='xlharc v' extract_lzh='xlharc x'
xit=0
for f
do echo "$f ..."
(
pipe="<\"\$f\""
pipeext=
format=
# break name up into pieces
case $f in */*) b=`basename "$f"` ;;
*) b=$f ;;
esac
oIFS=$IFS; IFS=.; set x $b; shift; IFS=$oIFS
nth=$#
while [ -z "$format" -a "$nth" -gt 0 ]
do
# get nth arg
eval "ext=\$$nth"
filt=
case $ext in
z) filt=unpack ;;
Z) filt=uncompress ;;
gz) filt=gunzip ;;
bz2) filt=bunzip2 ;;
pgp) filt='pgp -df' ;;
tgz) filt=gunzip format=tar ;;
arc|lzh) format=lzh ;;
uu) format=uu ;;
tar) format=tar ;;
cpio) format=cpio ;;
*) case $b in
cpiof*) format=cpio ;;
tarf*) format=tar ;;
*) break ;;
esac
;;
esac
[ -n "$filt" ] && { pipe="$pipe$pipeext $filt"
pipeext=" |"
}
# figured the format - bail and handle it
[ -n "$format" ] && break
# backstep for next pass
nth=`expr $nth - 1`
done
if [ -z "$format" ]
then
echo "$cmd: $f: unrecognised format" >&2
exit 1
else
eval "formatfilter=\$${mode}_$format"
pipe="$pipe$pipeext $formatfilter"
fi
eval "$pipe"
) || xit=1
done
exit $xit