select compressor initial script

This commit is contained in:
Blade of Darkness 2019-01-12 02:05:13 +01:00
parent 89f6c7a7f6
commit bf81502f5e
1 changed files with 35 additions and 0 deletions

35
multicompressor Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash -e
[[ -z $1 ]] &&
{
echo -e "Usage: `basename $0` (file/folder) to compress "
exit
}
FILE=$(basename $1)
[[ -z $2 ]] &&
{
echo -e "Usage: `basename $0` $FILE [ tar.gz | tar.bz2 | tar.lbz2 | tar.xz | tar.lz ]"
exit
}
tar -cf $FILE.tar $FILE
case "$2" in
tar.gz)
gzip $FILE.tar
;;
tar.xz)
xz -T $(nproc) $FILE.tar
;;
tar.bz2)
bzip2 $FILE.tar
;;
tar.lbz2)
lbzip2 -9 $FILE.tar
;;
tar.lz)
plzip -5 -n $(nproc) -v $FILE.tar
;;
esac