vrep.sh doesn't allow launching via absolute path or symlink
Posted: 24 Mar 2015, 17:27
Since vrep.sh doesn't allow launching it via absolute path (e.g. /opt/vrep/vrep.sh) nor via a symlink to it (e.g. /usr/local/bin/vrep pointing to /opt/vrep/vrep.sh), I modified it.
While editing it, I also added quotes where needed, so that in case the path to V-REP contains spaces, nothing breaks.
Here it is:
While editing it, I also added quotes where needed, so that in case the path to V-REP contains spaces, nothing breaks.
Here it is:
Code: Select all
#!/bin/sh
thisscript="$0"
while [ -L "$thisscript" ]; do
thisscript="`readlink "$thisscript"`"
done
dirname=`dirname "$thisscript"`
if [ $dirname = "." ]; then
dirname="$PWD"
fi
appname="`basename "$thisscript" | sed 's,\.sh$,,'`"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$dirname"
export LD_LIBRARY_PATH
"$dirname/$appname" "$@"