From 2d59518b40cf14a731276817c664ab52ea396b5c Mon Sep 17 00:00:00 2001 From: Johann Petrak Date: Mon, 16 Feb 2015 18:31:44 +0000 Subject: [PATCH] Make it so that the nel script can be run from anywgere. --- nel | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nel b/nel index 193b7d9..e7042bc 100755 --- a/nel +++ b/nel @@ -1,2 +1,20 @@ #!/bin/bash +PRG="$0" +CURDIR="`pwd`" +# 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 +SCRIPTDIR=`dirname "$PRG"` +if [ x"${PYTHONPATH}" == x ]; then + export PYTHONPATH="${SCRIPTDIR}" +else + export PYTHONPATH="${SCRIPTDIR}":${PYTHONPATH} +fi python -m neleval.__main__ "$@"