Skip to content

Instantly share code, notes, and snippets.

@xerial
Last active August 29, 2015 14:08
Show Gist options
  • Save xerial/5657cb4bef125ae8b261 to your computer and use it in GitHub Desktop.
Save xerial/5657cb4bef125ae8b261 to your computer and use it in GitHub Desktop.
Script for launching Scala REPL
#!/bin/sh
if [ -z "$PROG_HOME" ] ; then
## resolve links - $0 may be a link to PROG_HOME
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
PROG_HOME=`dirname "$PRG"`/..
# make it fully qualified
PROG_HOME=`cd "$PROG_HOME" && pwd`
cd "$saveddir"
fi
exec java -cp "${PROG_HOME}/conf:${PROG_HOME}/lib/*" -Dprog.home="${PROG_HOME}" -Dscala.usejavacp=true scala.tools.nsc.MainGenericRunner -Yrepl-sync -i "${PROG_HOME}/script/init.scala" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment