'source setenv' fails with bash on Windows
diaphore opened this issue · 2 comments
diaphore commented
setenv
running in bash
from the MSYS2 distribution provided with Git For Windows fails because of $0
being evaluated to /usr/bin/bash
:
$ echo 'export DJDIR="$(cd "$(dirname "$0")"; pwd)"/i586-pc-msdosdjgpp ; echo $DJDIR' > test.sh
$ cat test.sh
export DJDIR="$(cd "$(dirname "$0")"; pwd)"/i586-pc-msdosdjgpp ; echo $DJDIR
$ ./test.sh
/h/devel/djgpp/i586-pc-msdosdjgpp
$ source ./test.sh
/usr/bin/i586-pc-msdosdjgpp
Using ${BASH_SOURCE[0]}
instead of $0
fixes the problem.
ecm-pushbx commented
Had the same problem on a Debian server with bash "version 4.4.12(1)-release (x86_64-pc-linux-gnu)". Changed the $0 references to $BASH_SOURCE as indicated here:
https://stackoverflow.com/questions/21792176/0-doesnt-work-when-i-source-a-bash-script
andrewwutw commented
Fix in 4d2c854 .
You can download new setenv from :
to replace old one.