From 718274af9d216b5484337d0a1236d48dbf3311c4 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Mon, 15 May 2023 17:13:55 +0800 Subject: [PATCH] fix for empty lines --- sync.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 3525f59..a0652df 100755 --- a/sync.sh +++ b/sync.sh @@ -30,6 +30,9 @@ locked() { } do_sync() { + if [[ -z "$1" ]]; then + return; + fi local name="$1" local safe_name="${name//\//_}" local src="$2" @@ -50,10 +53,14 @@ do_sync() { } append_index() { + if [[ -z "$1" ]]; then + return; + fi echo "$1" >> "$STATUS_INDEX" } -echo > "$STATUS_INDEX" +rm "$STATUS_INDEX" +touch "$STATUS_INDEX" while read p || [[ -n $p ]]; do append_index $p done < "$THIS_DIR"/config