From 9e2e9894b1ddbe41d95ccfab706599d342643ac5 Mon Sep 17 00:00:00 2001 From: mbartlett21 Date: Mon, 3 Nov 2025 13:21:15 +1000 Subject: [PATCH] shutdown.sh: handle empty lines in /opt/.xfiletool.lst --- opt/shutdown.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/opt/shutdown.sh b/opt/shutdown.sh index 9488f4c..d97969f 100755 --- a/opt/shutdown.sh +++ b/opt/shutdown.sh @@ -12,14 +12,17 @@ if [ ! -e /tmp/backup_done ] || ! grep -q "^home" /opt/.filetool.lst; then awk 'BEGIN { FS=":" } $3 >= 1000 && $1 != "nobody" { print $1 }' /etc/passwd > /tmp/users while read U; do while read F; do - TARGET="/home/${U}/$F" - if [ -d "$TARGET" ]; then - rm -rf "$TARGET" - else - if [ -f "$TARGET" ]; then - rm -f "$TARGET" + # don't do rm -rf /home/tc/ + if [ -n "$F" ]; then + TARGET="/home/${U}/$F" + if [ -d "$TARGET" ]; then + rm -rf "$TARGET" + else + if [ -f "$TARGET" ]; then + rm -f "$TARGET" + fi fi fi - done < /opt/.xfiletool.lst - done < /tmp/users + done < /opt/.xfiletool.lst + done < /tmp/users fi