Merge pull request #2037 from NyaMisty/master

[Fixed] Adapt conda.bash for bash associative array
This commit is contained in:
Anton Petrov 2021-08-24 13:42:02 +03:00 committed by GitHub
commit b2eb2d28d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,14 +34,23 @@ make_shims() {
} }
deregister_conda_shims() { deregister_conda_shims() {
local shim # adapted for Bash 4.x's associative array (#1749)
local shims=() if declare -p registered_shims 2> /dev/null | grep -Eq '^(declare|typeset) \-A'; then
for shim in ${registered_shims}; do for shim in ${!registered_shims[*]}; do
if ! conda_shim "${shim}" 1>&2; then if conda_shim "${shim}" 1>&2; then
shims[${#shims[*]}]="${shim}" unset registered_shims[${shim}]
fi fi
done done
registered_shims=" ${shims[@]} " else
local shim
local shims=()
for shim in ${registered_shims}; do
if ! conda_shim "${shim}" 1>&2; then
shims[${#shims[*]}]="${shim}"
fi
done
registered_shims=" ${shims[@]} "
fi
} }
if conda_exists; then if conda_exists; then