Skip to content

Commit c3a87a7

Browse files
authored
Update support.sh: Use more efficient math expressions
1 parent 4e0a4b6 commit c3a87a7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

support.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,28 +448,28 @@ function generate_support_info()
448448

449449
# Create a list of logs that exist as well as their size.
450450
if [[ -f ${ALLSKY_LOG} ]]; then
451-
INDEX=$(( INDEX + 1 ))
451+
(( INDEX++ ))
452452
ALL_LOGS[${INDEX}]="${ALLSKY_LOG}"
453453
TMP_ZIP="${TEMP_DIR}/ALLSKY_LOG.zip"
454454
X_MB="$( get_actual_size "${TMP_ZIP}" "${ALLSKY_LOG}" )"
455-
TOTAL_SIZE_MB=$(( TOTAL_SIZE_MB + X_MB ))
455+
(( TOTAL_SIZE_MB += X_MB ))
456456
display_msg --logonly info "Zipped size of ${ALLSKY_LOG}: ${X_MB} MB."
457457
fi
458458
if [[ -f ${ALLSKY_LOG1} ]]; then
459-
INDEX=$(( INDEX + 1 ))
459+
(( INDEX++ ))
460460
ALL_LOGS[${INDEX}]="${ALLSKY_LOG1}"
461461
TMP_ZIP="${TEMP_DIR}/ALLSKY_LOG1.zip"
462462
X_MB="$( get_actual_size "${TMP_ZIP}" "${ALLSKY_LOG1}" )"
463-
TOTAL_SIZE_MB=$(( TOTAL_SIZE_MB + X_MB ))
463+
(( TOTAL_SIZE_MB += X_MB ))
464464
display_msg --logonly info "Zipped size of ${ALLSKY_LOG1}: ${X_MB} MB."
465465
fi
466466
if [[ -f ${ALLSKY_PERIODIC_LOG} ]]; then
467-
INDEX=$(( INDEX + 1 ))
467+
(( INDEX++ ))
468468
ALLSKY_LOG1_INDEX="${INDEX}"
469469
ALL_LOGS[${INDEX}]="${ALLSKY_PERIODIC_LOG}"
470470
TMP_ZIP="${TEMP_DIR}/ALLSKY_PERIODIC_LOG.zip"
471471
X_MB="$( get_actual_size "${TMP_ZIP}" "${ALLSKY_PERIODIC_LOG}" )"
472-
TOTAL_SIZE_MB=$(( TOTAL_SIZE_MB + X_MB ))
472+
(( TOTAL_SIZE_MB += X_MB ))
473473
display_msg --logonly info "Zipped size of ${ALLSKY_PERIODIC_LOG}: ${X_MB} MB."
474474
fi
475475

@@ -480,7 +480,7 @@ function generate_support_info()
480480
# If the ".1" log file is in the list, delete it, then recalculate the size.
481481
if [[ -n ${ALLSKY_LOG1_INDEX} ]]; then
482482
unset "ALL_LOGS[${ALLSKY_LOG1_INDEX}]"
483-
TOTAL_SIZE_MB=$(( TOTAL_SIZE_MB - ALLSKY_LOG1_SIZE_MB ))
483+
(( TOTAL_SIZE_MB -= ALLSKY_LOG1_SIZE_MB ))
484484
display_msg --logonly info "Not including ${ALLSKY_LOG1} gives a new size of ${TOTAL_SIZE_MB} MB."
485485
fi
486486

0 commit comments

Comments
 (0)