share: use BASH_SOURCE to reliably detect the script folder
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 17 Jan 2018 21:44:05 +0000 (16:44 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 17 Jan 2018 21:44:05 +0000 (16:44 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

share/android-bdwgc/setup.sh

index bcd931d..fcfbab3 100755 (executable)
 
 # Fetch libgc/bdwgc
 
-# cd to the absolute installation path
-if expr match "$0" "^/.*"; then
-       install="`dirname "$0"`"
-else
-       install="`pwd`/`dirname "$0"`"
-fi
-cd $install
+# cd to the installation path
+cd "`dirname "${BASH_SOURCE[0]}"`"
 
 # Download or redownload
 rm -rf bdwgc