1
0
Fork 0

make sure directory detection doesn't trigger when the first part of a directory name matches a directory

This commit is contained in:
Luca Bilke 2022-08-04 19:44:06 +02:00
parent 3b1a8c1332
commit d2f37ca42b
1 changed files with 1 additions and 1 deletions

View File

@ -2,7 +2,7 @@ PYENV_DIR="${PYENVS_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/virtualenv}"
function chpwd_activate(){
[[ "$(pwd)" == "/" ]] && return 0
for pydir in $(ls $PYENV_DIR); do
if [[ "$(pwd|sed -e s@/@_@g|cut -c2-)" =~ "^$pydir$" ]] || [[ "r-$(pwd|sed -e s@/@_@g|cut -c2-)" =~ "^$pydir" ]]; then
if [[ "$(pwd|sed -e s@/@_@g|cut -c2-)" =~ "^${pydir}$" ]] || [[ "r-$(pwd|sed -e s@/@_@g|cut -c2-)" =~ "^${pydir}(_.+)?$" ]]; then
if [ "x$VIRTUAL_ENV" != "x$PYENV_DIR/$pydir" ]; then
export PS1="$PS1"
export VIRTUAL_ENV_DISABLE_PROMPT=1