Deal negative value as positive

This commit is contained in:
Jeremy Gardais 2023-02-22 11:05:20 +01:00
parent 41ab85c8d1
commit 7040e36349
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 6 additions and 5 deletions

View File

@ -425,11 +425,12 @@ main() { # {{{
### }}}
### Compare current and previous sizes {{{
: $(( backup_dir_compare_size=backup_dir_current_size-backup_dir_previous_size ))
if [ "${backup_dir_compare_size}" -lt "${min_size_int}" ] ; then
debug_message "||| The differences between current and previous sizes is not enough (~${RED}${backup_dir_compare_size}${COLOR_DEBUG} ${min_size_unit})."
### Don't take care for negative value (remove minus sign)
if [ "${backup_dir_compare_size#-}" -lt "${min_size_int}" ] ; then
debug_message "||| The differences between current and previous sizes is not enough (~${RED}${backup_dir_compare_size#-}${COLOR_DEBUG} ${min_size_unit})."
backup_dir_email="True"
else
debug_message "||| The differences between current and previous sizes is correct (~${RED}${backup_dir_compare_size}${COLOR_DEBUG} ${min_size_unit})."
debug_message "||| The differences between current and previous sizes is correct (~${RED}${backup_dir_compare_size#-}${COLOR_DEBUG} ${min_size_unit})."
backup_dir_email="False"
fi
### }}}
@ -457,11 +458,11 @@ main() { # {{{
printf '%b' "## ${backup_dir}
Taille précédente pour cette sauvegarde/Previous size for this backup : ~${backup_dir_previous_size} ${min_size_unit} (compress).
Taille actuelle pour cette sauvegarde/Current size for this backup : ~${backup_dir_current_size} ${min_size_unit} (compress).
La différence de taille (~${backup_dir_compare_size} ${min_size_unit}) est inférieure au minimum attendu (${min_size}).
La différence de taille (~${backup_dir_compare_size#-} ${min_size_unit}) est inférieure au minimum attendu (${min_size}).
---
The difference (~${backup_dir_compare_size} ${min_size_unit}) is bellow the minimum expected size (${min_size}).
The difference (~${backup_dir_compare_size#-} ${min_size_unit}) is bellow the minimum expected size (${min_size}).
" >> "${user_email_template}"
### }}}
### Add all recorded informations from SQLite db {{{