From ce76f293885042b6160ab176db9e6d514db5e7c1 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 10 Mar 2018 22:23:26 +0800 Subject: cleanup(): check the item length before test its existence When there is no $TO_REMOVE_LATE, the generated $tmpfile list has an *empty line* at the end, which cause problem for the file existence test. --- dfly-update | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dfly-update') diff --git a/dfly-update b/dfly-update index d38e1e7..25826a0 100755 --- a/dfly-update +++ b/dfly-update @@ -516,8 +516,9 @@ cleanup() { make -f ${mk_upgrade} -V TO_REMOVE_LATE | tr ' ' '\n' >> ${tmpfile} # Credit: https://stackoverflow.com/a/10929511 + # [ -n "${item}" ]: do not ignore the last line if not end with a '\n' while IFS='' read -r item || [ -n "${item}" ]; do - if [ -e ${item} -o -L ${item} ]; then + if [ -n "${item}" ] && [ -e ${item} -o -L ${item} ]; then echo " * ${item}" chflags -Rf noschg ${item} rm -rf ${item} -- cgit v1.2.2