dbpedia-docs icon indicating copy to clipboard operation
dbpedia-docs copied to clipboard

scripts should not depend for correct operation on the CWD on invocation

Open neradis opened this issue 11 years ago • 0 comments

Some scripts like scripts / download / other / geonames_download.sh rely on being executed in the directory where they reside, which is inconvenient if one intends to download the datasets in a location outside of the dbpedia documentation tree. Instead of relying on the current working directory, scripts could (and arguably should) use SCRIPT_DIR obtained by something like:

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Note: To be sure to get the correct SCRIPT_DIR if the script was invoked via a symlink, additional logic is needed as shown in Stackoverflow: Can a Bash script tell what directory it's stored in?

neradis avatar Oct 05 '14 13:10 neradis