fi
DIR=${1%/}
+BASE=$(basename ${DIR})
# Checking if directory exists.
if [ ! -d ${DIR} ]; then
fi
# Decompressing file to standard output and piping result to bzip2
-tar cvf - ${DIR} | bzip2 -9 > ${DIR}.tar.bz2
+tar cvf - ${DIR} | bzip2 -9 > ${BASE}.tar.bz2
exit $?