From c8aa0fa4b67bc503f37976de87d8a94913c12e8d Mon Sep 17 00:00:00 2001 From: fiftydinar <65243233+fiftydinar@users.noreply.github.com> Date: Sun, 21 Jul 2024 16:08:21 +0200 Subject: [PATCH] fix(files): Deleting .gitkeep file when path is ending in `/` pt.2 I forgot to account for the literal `/` folder scenario --- modules/files/files.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/files/files.sh b/modules/files/files.sh index 3ce87bd..aef2194 100644 --- a/modules/files/files.sh +++ b/modules/files/files.sh @@ -37,7 +37,7 @@ if [[ ${#FILES[@]} -gt 0 ]]; then fi echo "Copying $FILE to $DEST" cp -rf "$FILE"/* $DEST - if [[ "${DEST}" =~ */ ]]; then + if [[ "${DEST}" =~ *"/" ]] || [[ "${DEST}" == "/" ]]; then rm -f "${DEST}.gitkeep" else rm -f "${DEST}/.gitkeep" @@ -49,7 +49,7 @@ if [[ ${#FILES[@]} -gt 0 ]]; then fi echo "Copying $FILE to $DEST" cp -f $FILE $DEST - if [[ "${DEST}" =~ */ ]]; then + if [[ "${DEST}" =~ *"/" ]] || [[ "${DEST}" == "/" ]]; then rm -f "${DEST}.gitkeep" else rm -f "${DEST}/.gitkeep"