Skip to content

Commit 034f902

Browse files
committed
Eliminate unnecessary index variable
1 parent ff61f9c commit 034f902

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

bin/pyenv-users

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,12 @@ fi
7676

7777
# Collect all symlinks named `python` that point into $PYENV_ROOT
7878
cmd="readlink -f '{}' | grep -q ${PYENV_ROOT}"
79-
unset i
8079
while IFS= read -r -d $'\0' file; do
81-
links[i++]="$file"
80+
links+=("$file")
8281
done < <(find -H "$DIR" -name "python" -type l -exec sh -c "$cmd" \; -print0)
8382

8483
# Turn each link into a (version, venv) string pair
8584
regex="${PYENV_ROOT}/versions/(.+)/bin/(.+)"
86-
unset i
8785
for link in "${links[@]}"; do
8886
linkpath=$(realpath -s "$link")
8987
target=$(readlink -f "$link")
@@ -93,8 +91,8 @@ for link in "${links[@]}"; do
9391
if grep -v -q "$PYENV_ROOT" <<< "$linkpath" || \
9492
grep -q "$PYENV_ROOT/versions/$version/envs" <<< "$linkpath"
9593
then
96-
versions[i]="$version"
97-
venvs[i++]="${link%/bin/python}"
94+
versions+=("$version")
95+
venvs+=("${link%/bin/python}")
9896
fi
9997
done
10098

0 commit comments

Comments
 (0)