-
Notifications
You must be signed in to change notification settings - Fork 8
/
plt-bin
executable file
·42 lines (32 loc) · 904 Bytes
/
plt-bin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# the executable name is whatever link is running this
EXE="`basename \"$0\"`"
if [[ "$PLTHOME" = "" ]]; then
echo "$EXE: PLTHOME has not been set." 1>&2; exit -1
fi
if [[ ! -d "$PLTHOME" ]]; then
echo "$EXE: PLTHOME directory does not exist: $PLTHOME" 1>&2; exit -11
fi
PLTADDONDIR="$PLTHOME/add-on"
export PLTHOME PLTCOLLECTS PLTADDONDIR
# or run this script and give it an executable argument
if [[ "$EXE" = "plt-bin" && "$1" != "" ]]; then EXE="$1"; shift; fi
# short names
if [[ "${#EXE}" -le 5 ]]; then
case "$EXE" in
( r ) EXE="racket" ;;
( dr ) EXE="drracket" ;;
( gr ) EXE="gracket" ;;
esac
fi
BIN="$PLTHOME/racket/bin/$EXE"
# support pre-package repository layout
OLDBIN="$PLTHOME/bin/$EXE"
if [[ -x "$BIN" ]]; then
exec "$BIN" "$@"
elif [[ -x "$OLDBIN" ]]; then
exec "$OLDBIN" "$@"
else
echo "$NAME: no executable at \"$BIN\"."
exit -1
fi