1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

ctdb-scripts: Avoid shellcheck warning SC2012 (ls for file list)

SC2012: Use find instead of ls to better handle non-alphanumeric filenames.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-07-13 06:53:21 +10:00 committed by Amitay Isaacs
parent 5e9aa57c05
commit 52b43d73e9

View File

@ -93,9 +93,12 @@ EOF
mv "$_db" "$_backup"
# Now remove excess backups
ls -td "${_db}."*".corrupt" |
tail -n +$((${CTDB_MAX_CORRUPT_DB_BACKUPS:-10} + 1)) |
xargs rm -f
_max="${CTDB_MAX_CORRUPT_DB_BACKUPS:-10}"
_bdb="${_db##*/}" # basename
find "$_dir" -name "${_bdb}.*.corrupt" |
sort -r |
tail -n +$((_max + 1)) |
xargs rm -f
}
done
}