Skip to content

Commit 28a70cf

Browse files
authored
Merge pull request #117 from ferdnyc/cross-shell
Set VIRTUALENVWRAPPER_SCRIPT portably
2 parents 32e6a2e + 23c86d9 commit 28a70cf

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

virtualenvwrapper.sh

+6-9
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

@@ -430,7 +427,7 @@ function mkvirtualenv {
430427
i=0
431428
tst="-lt"
432429
fi
433-
while [ $i $tst $# ]
430+
while test $i $tst $#
434431
do
435432
a="${in_args[$i]}"
436433
# echo "arg $i : $a"
@@ -712,7 +709,7 @@ function workon {
712709
tst="-lt"
713710
fi
714711
typeset cd_after_activate=$VIRTUALENVWRAPPER_WORKON_CD
715-
while [ $i $tst $# ]
712+
while test $i $tst $#
716713
do
717714
a="${in_args[$i]}"
718715
case "$a" in
@@ -1111,7 +1108,7 @@ function mkproject {
11111108
i=0
11121109
tst="-lt"
11131110
fi
1114-
while [ $i $tst $# ]
1111+
while test $i $tst $#
11151112
do
11161113
a="${in_args[$i]}"
11171114
case "$a" in
@@ -1218,7 +1215,7 @@ function mktmpenv {
12181215
tst="-lt"
12191216
fi
12201217
typeset cd_after_activate=$VIRTUALENVWRAPPER_WORKON_CD
1221-
while [ $i $tst $# ]
1218+
while test $i $tst $#
12221219
do
12231220
a="${in_args[$i]}"
12241221
case "$a" in

0 commit comments

Comments
 (0)