prevent calling rm if absent folder exists but is empty - drist - a remote deployment tool HTML git clone git://bitreich.org/drist/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/drist/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 4dd8e8e02dac1c139f85edafe0a46c9f4f3c5375 DIR parent 92aca81f5528fe453c8da9dda92c5bf27f706572 HTML Author: Solene Rapenne <solene@perso.pw> Date: Mon, 13 Aug 2018 13:42:38 +0200 prevent calling rm if absent folder exists but is empty Diffstat: M drist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- DIR diff --git a/drist b/drist @@ -54,7 +54,7 @@ delete_files() { printf 'Removing files:\n' find "$1" -type f | sed 's/"/\\&/' | \ awk -v path="${1}" '{ printf "\"%s\" ",substr($0,length(path)+1)}' > "${LIST}" - ssh "$2" "rm -v $(cat $LIST)" + test -s "$LIST" && ssh "$2" "rm -v $(cat $LIST)" fi fi }