From 4654fd62f4e8ed6f8d9783f465f04ae18b68d4e5 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 6 Jan 2016 15:35:08 +0100 Subject: Do not divide by zero --- bin/ftpsync | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/ftpsync b/bin/ftpsync index ad53598..385aa92 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -211,8 +211,10 @@ tracefile() { done echo "Total bytes received in rsync: ${total}" echo "Total time spent in rsync: ${STATS_TOTAL_RSYNC_TIME}" - rate=$(( total / STATS_TOTAL_RSYNC_TIME )) - echo "Average rate: ${rate} B/s" + if [[ 0 != ${STATS_TOTAL_RSYNC_TIME} ]]; then + rate=$(( total / STATS_TOTAL_RSYNC_TIME )) + echo "Average rate: ${rate} B/s" + fi fi # full trace fi # other traces } > "${TRACEFILE}.new" -- cgit v1.2.3