Skip to content

Commit 5840f04

Browse files
committed
Set VIRTUALENVWRAPPER_SCRIPT portably
- `${.sh.file}` was ksh syntax, but ksh support was dropped in commit d736549 - Instead of testing only for certain specific shells (and excluding all others), use `$BASH_SOURCE` if it's set, otherwise fall back to `$0` which should work with more shells (hopefully). Fixes #105
1 parent 26f7c0a commit 5840f04

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

virtualenvwrapper.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,11 @@ export VIRTUALENVWRAPPER_WORKON_CD=${VIRTUALENVWRAPPER_WORKON_CD:-1}
9696
# Remember where we are running from.
9797
if [ -z "${VIRTUALENVWRAPPER_SCRIPT:-}" ]
9898
then
99-
if [ -n "$BASH" ]
99+
if [ -n "${$BASH_SOURCE:-}" ]
100100
then
101101
export VIRTUALENVWRAPPER_SCRIPT="$BASH_SOURCE"
102-
elif [ -n "$ZSH_VERSION" ]
103-
then
104-
export VIRTUALENVWRAPPER_SCRIPT="$0"
105102
else
106-
export VIRTUALENVWRAPPER_SCRIPT="${.sh.file}"
103+
export VIRTUALENVWRAPPER_SCRIPT="$0"
107104
fi
108105
fi
109106

0 commit comments

Comments
 (0)