fix some incorrect variable names
This commit is contained in:
1 parent
5e07f58248
commit
4a0a1ff9a7
1 file changed
+7
-5
+7
-5
@@ -17,10 +17,10 @@ main() {
|
||||
x)
|
||||
declare -g EXTENSION
|
||||
if [[ "${OPTARG,,}" == 'none' ]]; then
|
||||
EXTENTION=""
|
||||
EXTENSION=""
|
||||
else
|
||||
command -v "$OPTARG" >/dev/null 2>&1 || { echo "$OPTARG command not found"; exit 1; }
|
||||
EXTENTION="${OPTARG,,}"
|
||||
EXTENSION="${OPTARG,,}"
|
||||
fi
|
||||
|
||||
declare -g COMPRESSION="$OPTARG"
|
||||
@@ -91,9 +91,11 @@ start_backup() {
|
||||
local vm=$1
|
||||
local backup_base="$2"
|
||||
local compression="${COMPRESSION:-none}"
|
||||
local ext="${EXTENTION}" ; [[ -n "$ext" ]] && ext=".${ext}"
|
||||
local ext="${EXTENSION}" ; [[ -n "$ext" ]] && ext=".${ext}"
|
||||
local destination="${backup_base}/${vm}"
|
||||
local backup_name="${vm}_$(date +"%Y-%m-%d_%H-%M-%S").tar${ext}"
|
||||
|
||||
local backup_name
|
||||
backup_name="${vm}_$(date +"%Y-%m-%d_%H-%M-%S").tar${ext}"
|
||||
|
||||
[[ -d "$backup_base" ]] || { echo "${backup_base} is not a directory"; exit 1; }
|
||||
[[ -d "$destination" ]] || mkdir "$destination"
|
||||
@@ -109,7 +111,7 @@ prune_backups() {
|
||||
mapfile -t backup_files < <(find "$backup_directory" -maxdepth 1 -type f -printf '%T@ %p\n' | sort -n | head -n "-${files_to_keep}" | cut -d' ' -f2-)
|
||||
|
||||
if [[ ${#backup_files[@]} -gt 0 ]]; then
|
||||
echo "Removing ${#qcow2_files[@]} old backup files for $vm (keeping last $total_files_to_keep files)"
|
||||
echo "Removing ${#backup_files[@]} old backup files for $vm (keeping last $files_to_keep files)"
|
||||
printf '%s\0' "${backup_files[@]}" | xargs -0 rm -fv
|
||||
else
|
||||
echo "No old backups to remove for $vm"
|
||||
|
||||
Reference in new issue
Block a user