12345678910111213141516171819 |
- #!/bin/bash -e
- if [ $# -gt 0 ]; then
- NAME="$1"
- shift
- else
- NAME="$(basename $(pwd))"
- fi
- VERSION="$(cat *.cabal | grep -e '^version' | grep -o -e '[0-9.]*')"
- PROGRAM="$(find dist-newstyle -type f -executable -name "$NAME" | grep -e "${VERSION}" | head -n 1)"
- if [ ! "${PROGRAM}" = "" ]; then
- exec "${PROGRAM}" $@
- else
- echo "cannot find executable: ${NAME}-${VERSION}" >&2
- exit 99
- fi
|