Skip to content

Commit

Permalink
Throwing explicit error for more than one argument (supporting -h and
Browse files Browse the repository at this point in the history
--help)
  • Loading branch information
gergoszekely authored and Emily Curtin committed Nov 8, 2017
1 parent d0d4908 commit ef56528
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion bin/spark-bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,25 @@ mainclass="com.ibm.sparktc.sparkbench.sparklaunch.SparkLaunch"
launchjar=$(ls "$jars"/spark-bench-launch-[0-9]*.jar)
sparkbenchjar=$(ls "$jars"/spark-bench-[0-9]*.jar)

java -cp "$launchjar" "$mainclass" "$@"
print_usage()
{
echo "Usage: spark-bench.sh <PATH_TO_CONFIGURATION_FILE>"
echo "i.e.: ./bin/spark-bench.sh ./examples/minimal-example.conf"
echo "(https://github.com/SparkTC/spark-bench#running-the-examples-from-the-distribution)"
}

if [ $# -ne 1 ]
then
echo "spark-bench takes exactly ONE argument."
print_usage
else
case ${1} in
-h|--help)
print_usage
exit 1
;;
esac

java -cp "$launchjar" "$mainclass" "$@"

fi

0 comments on commit ef56528

Please sign in to comment.