#!/usr/bin/env bash
|
|
|
|
function help()
|
|
{
|
|
echo "Help:"
|
|
echo "-----"
|
|
echo ""
|
|
echo "lch [-h] [-v] [-c] [-i] [FILE [FILE...]]"
|
|
echo ""
|
|
echo "Examples:"
|
|
echo "$ lch -h - This help"
|
|
echo "$ lch -v - Print version"
|
|
echo "$ lch -c - Check compresion systems"
|
|
echo "$ lch -i - Install the compressors dependencies"
|
|
echo "$ lch file.zip - Decompress"
|
|
echo "$ lch file.zip /home/file - Compress"
|
|
echo "$ lch files.zip file1 file2 - Compress multiple"
|
|
echo ""
|
|
echo "Supported extensions:"
|
|
echo " rar, tar, tar.gz, tar.bz2, tar.xz, bz2, tgz, gz, zip, 7z"
|
|
echo ""
|
|
echo "Run 'man lch' for more info."
|
|
echo ""
|
|
}
|
|
|
|
function check()
|
|
{
|
|
local a=false
|
|
echo -e "Verification of compression systems:\n"
|
|
echo -e "Systems\t\t\tStatus"
|
|
echo "----------------------------------"
|
|
for i in "rar" "unrar" "tar" "bzip2" "gzip" "zip" "unzip" "7za"
|
|
do
|
|
if ! [ -x "$(command -v $i)" ]
|
|
then
|
|
echo -e "$i\t\t\t\e[91mNot Installed\e[0m"
|
|
$a = true
|
|
else
|
|
echo -e "$i\t\t\t\e[32mInstalled\e[0m"
|
|
fi
|
|
done
|
|
|
|
if $a
|
|
then
|
|
echo -e "\nIn order to use all the extensions install the packages: tar, bzip2, gzip, zip, unzip, 7za, rar, unrar"
|
|
fi
|
|
echo ""
|
|
exit 0
|
|
}
|
|
|
|
function lowercase()
|
|
{
|
|
echo "$DEST" | tr 'A-Z' 'a-z'
|
|
}
|