#!/bin/bash # A POSIX variable OPTIND=1 # Reset in case getopts has been used previously in the shell. # Initialize our own variables: memory="" while getopts "h?m:f:t:p:c:" opt; do case "$opt" in h|\?) echo "Usage: main -f problem.json -t time -m memory -p powerPhrase" exit 0 ;; m) memory="+RTS -M"$OPTARG"m" ;; esac done cd "$( dirname "${BASH_SOURCE[0]}" )" dist/build/icfp2015/icfp2015 "$@" $memory