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:
parent
5e9aa57c05
commit
52b43d73e9
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user