From 4d146ea652c5bec09a59bf60c432dfcbcda408ea Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sat, 21 Oct 2017 12:40:10 +0900 Subject: [PATCH] Avoid looking at other plugin shims when reshiming --- lib/commands/reshim.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/commands/reshim.sh b/lib/commands/reshim.sh index b2f08741..aa965726 100644 --- a/lib/commands/reshim.sh +++ b/lib/commands/reshim.sh @@ -184,11 +184,12 @@ remove_obsolete_shims() { local install_path install_path=$(get_install_path "$plugin_name" "$install_type" "$version") - for shim_path in "$shims_path"/*; do + local target_shims + target_shims=($(grep -lr "# asdf-plugin: $plugin_name" $shims_path)) + for shim_path in "${target_shims[@]}"; do local shim_name shim_name="$(basename "$shim_path")" - if grep "# asdf-plugin: $plugin_name" "$shim_path" > /dev/null && \ - grep "# asdf-plugin-version: $version" "$shim_path" > /dev/null && \ + if grep "# asdf-plugin-version: $version" "$shim_path" > /dev/null && \ ! shim_still_exists "$shim_name" "$install_path" "$space_separated_list_of_bin_paths"; then remove_shim_for_version "$plugin_name" "$shim_name" "$version" fi