Browse Source

make more POSIX compliant

master
max.mehl 3 years ago
parent
commit
1ad4c88d75
Signed by: mxmehl GPG Key ID: 2704E4AB371E2E92
  1. 4
      uberspace-backup.sh

4
uberspace-backup.sh

@ -100,9 +100,9 @@ while read line; do
rm ${DEST}.tar
# Delete all old directories except the $MAXBAK most recent
if [ $(ls -tp "${BACKUPDIR}"/"${RHOST}"/ | grep '/$' | wc -l) -gt $MAXBAK ]; then
if [ $(ls -tp "${BACKUPDIR}"/"${RHOST}"/ | grep '/$' | wc -l | tr -d ' ') -gt $MAXBAK ]; then
logecho "${RHOST}: Removing older backups of $(basename ${DEST})"
ls -tpd "${BACKUPDIR}"/"${RHOST}"/* | grep '/$' | tail -n +$[$MAXBAK + 1] | xargs -d '\n' rm -r --
ls -tpd "${BACKUPDIR}"/"${RHOST}"/* | grep '/$' | tail -n +$[$MAXBAK + 1] | xargs -0 | xargs rm -r --
fi
done

Loading…
Cancel
Save