From 185d99fade6790c550d63a013c23000b05633089 Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Sun, 26 Jun 2022 09:02:42 +0300 Subject: [PATCH] remove-old-kernels: Do not try to output removal list if it's empty Fixes: 573337d ("remove-old-kernels: Change confirmation logic") Signed-off-by: Vitaly Chikunov --- remove-old-kernels | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/remove-old-kernels b/remove-old-kernels index 0d37863..db9cfdd 100755 --- a/remove-old-kernels +++ b/remove-old-kernels @@ -175,16 +175,16 @@ printf "%s" "$keep_kernels" [ -n "$other_flavours" ] && echo "Specify -A to remove all kernels of other flavours than $kernel_flavour." echo -howmuch=$(echo "$remove_kernels" | grep -c .) -[ "$howmuch" -eq 1 ] && phrase="this kernel" || phrase="these $BRIGHT$howmuch$NORM kernels" -echo "Removing $phrase:" -echo "$remove_kernels" - if [ -z "$apt_args_list" ] ; then echo "Nothing to remove." exit 0 fi +howmuch=$(echo "$remove_kernels" | grep -c .) +[ "$howmuch" -eq 1 ] && phrase="this kernel" || phrase="these $BRIGHT$howmuch$NORM kernels" +echo "Removing $phrase:" +echo "$remove_kernels" + if [ "$UID" != "0" ]; then echo >&2 "${RED}Warning: This program requires root privileges.$NORM" fi