Add lz and its README
This commit is contained in:
parent
7fc8da48cd
commit
1bcd00d005
|
@ -0,0 +1,12 @@
|
|||
The lz script emulates and extends the lz and uz commands of the mtools.
|
||||
|
||||
It handles: .tar, .tar.gz, .tar.bz2, .tar.xz and .tar.lzma, through the
|
||||
standards options of GNU tar.
|
||||
|
||||
If the script name is "lz", the archive content is displayed. If the name
|
||||
is "uz", it is extracted.
|
||||
|
||||
To install lz and uz, move put script in a directory in the PATH (for
|
||||
instance /usr/local/bin) and hard link it to uz:
|
||||
cp lz /usr/local/bin
|
||||
ln /usr/local/bin/{lz,uz}
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
# This script emulates and extends the lz and uz commands of the mtools.
|
||||
# It handles: .tar, .tar.gz, .tar.bz2, .tar.xz and .tar.lzma, through the
|
||||
# standards options of GNU tar.
|
||||
# If the script name is "lz", the archive content is displayed. If the name
|
||||
# is "uz", it is extracted.
|
||||
|
||||
PROGRAM=`basename $0`
|
||||
|
||||
if [ "$PROGRAM" = "lz" ] ; then
|
||||
ACTION="t"
|
||||
elif [ "$PROGRAM" = "uz" ] ; then
|
||||
ACTION="x"
|
||||
else
|
||||
echo '$0 = "'"$0"' (not "lz" nor "uz")!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ `basename "$1" .tar` != "$1" ] ; then
|
||||
FORMAT=""
|
||||
elif [ `basename "$1" .tar.gz` != "$1" ] ; then
|
||||
FORMAT="--gzip"
|
||||
elif [ `basename "$1" .tar.bz2` != "$1" ] ; then
|
||||
FORMAT="--bzip"
|
||||
elif [ `basename "$1" .tar.xz` != "$1" ] ; then
|
||||
FORMAT="--xz"
|
||||
elif [ `basename "$1" .tar.lzma` != "$1" ] ; then
|
||||
FORMAT="--lzma"
|
||||
fi
|
||||
|
||||
tar "$FORMAT" -"$ACTION"f "$@"
|
Loading…
Reference in New Issue