From 4e882b0dda774d9d317a3844d0fea601f99e586e Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Sun, 18 Feb 2024 18:36:41 +0300 Subject: [PATCH] Archive : Prune fix name matching. --- .config/bash/module/Archive.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/bash/module/Archive.sh b/.config/bash/module/Archive.sh index 37d7171..1d59fb3 100644 --- a/.config/bash/module/Archive.sh +++ b/.config/bash/module/Archive.sh @@ -1,5 +1,5 @@ -export _archive_pattern="_[0-9]{12}-[[:alnum:]]{40}.t[xg]z" -export _archive_pattern_fast="_[0-9]{12}-[[:alnum:]]{40}.tgz" +export _archive_pattern="_[0-9]{12}-[[:alnum:]]{40}.t[xg]z$" +export _archive_pattern_fast="_[0-9]{12}-[[:alnum:]]{40}.tgz$" # Archive directories. # All directories by default. @@ -131,7 +131,7 @@ function archive_prune() { fi process() { - local prune=($(ls ${target}* | _filter_archive | sort -r | sed -e "1,${versions}d")) + local prune=($(ls | grep -E "^${target}${_archive_pattern}" | sort -r | sed -e "1,${versions}d")) for archive in ${prune[@]}; do rm -- "${archive}" && echo "${archive}"