Apply shellcheck suggestions to new-cabal-exec
Getty Ritter
8 years ago
| 4 | 4 | NAME="$1" |
| 5 | 5 | shift |
| 6 | 6 | else |
| 7 |
NAME="$(basename |
|
| 7 | NAME="$(basename "$(pwd)")" | |
| 8 | 8 | fi |
| 9 | 9 | |
| 10 |
VERSION="$(cat |
|
| 10 | VERSION="$(cat ./*.cabal | grep -e '^version' | grep -o -e '[0-9.]*')" | |
| 11 | 11 | PROGRAM="$(find dist-newstyle -type f -executable -name "$NAME" | grep -e "${VERSION}" | head -n 1)" |
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | if [ ! "${PROGRAM}" = "" ]; then |
| 15 |
exec "${PROGRAM}" |
|
| 15 | exec "${PROGRAM}" "$@" | |
| 16 | 16 | else |
| 17 | 17 | echo "cannot find executable: ${NAME}-${VERSION}" >&2 |
| 18 | 18 | exit 99 |