Fix unexpected script_path behaviour
Compare changes
Files
2+ 1
− 1
Due to an influx of spam, we have had to temporarily disable account registrations. Please write an email to accountsupport@archlinux.org, with your desired username, if you want to get access. Sorry for the inconvenience.
When one calls the build.sh
scripts with bash instead of the shebang
$script_path
contains the filepath, not the parent dir:
# cd /path
# grep -A2 script_path= build.sh
script_path=$(readlink -f "${0%/*}")
echo "$script_path"
exit 0
# ./build.sh
/path
# bash build.sh
/path/build.sh
This commit fixes that:
# grep -A2 script_path= build.sh
script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )"
echo "$script_path"
exit 0
# ./build.sh
/path
# bash build.sh
/path