From 56aff39252b1d78a43a441d14e96aa05c86e52dc Mon Sep 17 00:00:00 2001 From: Nicolas de Sereville <deserevi@ipno.in2p3.fr> Date: Thu, 21 Jan 2016 16:37:18 +0100 Subject: [PATCH] + update nptool.sh configuration script --- nptool.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) mode change 100644 => 100755 nptool.sh diff --git a/nptool.sh b/nptool.sh old mode 100644 new mode 100755 index 7e10b53b9..887754e1d --- a/nptool.sh +++ b/nptool.sh @@ -1,18 +1,17 @@ #!/bin/bash -# source this file to setup your NPTOOL installation -CUR_DIR="$PWD" -SCRIPTFILE=$0 -if [ "${SCRIPTFILE}" = "-bash" ] ; then - SCRIPTFILE=${BASH_ARGV[0]} -elif [ "${SCRIPTFILE}" = "bash" ] ; then - SCRIPTFILE=${BASH_ARGV[0]} -fi - -SCRIPTPATH="${SCRIPTFILE}" +# find script path +if [ -n "$ZSH_VERSION" ]; then + SCRIPTPATH="$( cd "$( dirname "${(%):-%x}" )" && pwd )" +elif [ -n "$BASH_VERSION" ]; then + SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +else + echo "neither bash or zsh is used, abort" + exit 1 +fi -export NPTOOL=$(dirname $SCRIPTPATH) -export NPLIB=$NPTOOL/NPLib +# export NPTOOL environment variable +export NPTOOL=$SCRIPTPATH NPARCH=$(uname) # mac os x case @@ -25,7 +24,7 @@ else export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NPTOOL/NPSimulation/lib fi -export PATH=$PATH:$NPLIB/bin +export PATH=$PATH:$NPTOOL/NPLib/bin export PATH=$PATH:$NPTOOL/NPSimulation/bin alias npt='cd $NPTOOL' -- GitLab