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.
This commit is contained in:
caem 2024-05-10 13:20:41 +02:00
parent 7f35cdc86a
commit 45d4b8bad6
No known key found for this signature in database
GPG key ID: 3BCEDBB0C38805DA

View file

@ -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."