From 2d818a19d103c086ea27cab7d165653e08b38f9d Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 18 Jun 2022 19:00:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drepo=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/update.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shell/update.sh b/shell/update.sh index 01ffd0bd..e4aefcd2 100755 --- a/shell/update.sh +++ b/shell/update.sh @@ -12,14 +12,16 @@ diff_cron() { local list_task="$2" local list_add="$3" local list_drop="$4" - if [[ -s $list_task ]]; then + if [[ -s $list_task ]] && [[ -s $list_scripts]]; then grep -vwf $list_task $list_scripts >$list_add - elif [[ ! -s $list_task ]] && [[ -s $list_scripts ]]; then + grep -vwf $list_scripts $list_task >$list_drop + fi + + if [[ ! -s $list_task ]] && [[ -s $list_scripts ]]; then cp -f $list_scripts $list_add fi - if [[ -s $list_scripts ]]; then - grep -vwf $list_scripts $list_task >$list_drop - else + + if [[ ! -s $list_scripts ]] && [[ -s $list_task ]]; then cp -f $list_task $list_drop fi }