cleanup delete_from_file(): clean suffix stuff

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
Nico Schottelius 2009-10-30 19:26:32 +01:00
parent 4865f3c8c6
commit 8a70e30d97

View file

@ -108,10 +108,9 @@ pcmd()
delete_from_file() delete_from_file()
{ {
file="$1"; shift file="$1"; shift
suffix="$1" # only set for delete_incomplete suffix="$1" # only set, if deleting incomplete backups
# [ "$#" = 1 ] && suffix="$1" && shift
while read to_remove; do while read to_remove; do
set -- "$@" "${ddir}/${to_remove}" set -- "$@" "${to_remove}"
[ "$suffix" ] && set -- "$@" "$(echo ${to_remove} | sed "s/$suffix\$//")" [ "$suffix" ] && set -- "$@" "$(echo ${to_remove} | sed "s/$suffix\$//")"
done < "${file}" done < "${file}"
_techo "Removing $@ ..." _techo "Removing $@ ..."