From 45d4b8bad665fb09102d70704f708c5052d3c709 Mon Sep 17 00:00:00 2001 From: caem Date: Fri, 10 May 2024 13:20:41 +0200 Subject: [PATCH] Fix detection of having no packages Sometimes empty elements containing only spaces are pushed in to the packages array, before the code would only detect that there are no pacakges to install when only one spaces was inserted, now it should work for any arbitrary count of elements containing only spaces. --- zypper_autoremove.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zypper_autoremove.bash b/zypper_autoremove.bash index b0a75f7..b43852f 100755 --- a/zypper_autoremove.bash +++ b/zypper_autoremove.bash @@ -13,7 +13,7 @@ done < <(echo "$package_list" | tail -n+$((table_start+2))) unneeded_package_list=$(printf '%s ' "${unneeded_packages[@]}") -if [ ! "$unneeded_package_list" = " " ]; then +if [ -n "$(echo $unneeded_package_list | tr -d ' ')" ]; then sudo zypper rm -u $unneeded_package_list else echo "No unneeded packages."