#!/bin/bash set -e set -u dir=$(dirname "$0") usage=" Usage: $0 [options] Allowed options: -d : debug mode -r : run mode -c : clean mode -h : echo this usage statement " debug=0 run=0 clean=0 while getopts drcfh opt do case $opt in d) debug=1;; r) run=1;; c) clean=1;; h) echo $usage exit 0;; \?) echo $usage exit 1;; esac done shift `expr $OPTIND - 1` if [[ "$clean" -eq 1 ]] then cd "$dir" && make clean exit fi if [[ "$debug" -eq 1 ]] then cd "$dir" && make debug else cd "$dir" && make fi if [[ $run -eq 1 ]] then cd "$dir" && ./derive_test fi