#!/bin/sh
-PROG_NAME=$(basename $0)
+PROG_NAME="`readlink -e $0`"
+PROG_PATH=$(dirname ${PROG_NAME})
+. ${PROG_PATH}/hvutilities.sh
BZIP2_BIN=bzip2
echo " Default is same name as the input directory."
}
-while getopts "hf:" flag ;do
+while getopts "hf:" flag; do
case ${flag} in
- h)
- print_usage
- ;;
- f)
- DEST=${OPTARG}
- ;;
- ?)
- echo "${PROG_NAME}: Invalid option: ${OPTARG}."
- echo "Try \`${PROG_NAME} --help' for more information."
- exit 1
+ h)
+ print_usage
+ exit 0
;;
+ f)
+ DEST=${OPTARG}
+ ;;
+ ?)
+ log_err "${PROG_NAME}: Invalid option: ${OPTARG}."
+ log_err "Try \`${PROG_NAME} --help' for more information."
+ exit 1
+ ;;
esac
done
shift `expr "${OPTIND}" - 1`
# `$#' now represents the number of arguments after the options.
# `$1' is the first argument, etc.
if [ ${#} -eq 0 ]; then
- echo "${PROG_NAME}: Missing source directory."
- echo "Try \`${PROG_NAME} --help' for more information."
+ log_err "${PROG_NAME}: Missing source directory."
+ log_err "Try \`${PROG_NAME} --help' for more information."
exit 1
elif [ ${#} -gt 1 ]; then
- echo "${PROG_NAME}: Too many arguments."
- echo "Try \`${PROG_NAME} --help' for more information."
+ log_err "${PROG_NAME}: Too many arguments."
+ log_err "Try \`${PROG_NAME} --help' for more information."
exit 1
fi
# Checking if directory exists.
if [ ! -d ${DIR} ]; then
- echo "$0: Directory ${DIR} not found."
+ log_err "$0: Directory ${DIR} not found."
exit 1
fi