diff --git a/zfs_snapshot_cron.sh b/zfs_snapshot_cron.sh index 2b454e6..ad7fa83 100755 --- a/zfs_snapshot_cron.sh +++ b/zfs_snapshot_cron.sh @@ -39,13 +39,13 @@ handle_pool() { if [ $D -gt 0 ]; then D=$(( D-1 )) echo "KEEP; D: $D" - elif [ $W -gt 0 ] && [ ${scomp[3]} -eq 1 ]; then + elif [ $W -gt 0 ] && [ ${scomp[3]#0} -eq 1 ]; then W=$(( W-1 )) echo "KEEP; W: $W" - elif [ $M -gt 0 ] && [ ${scomp[3]} -eq 1 ] && [ $(( scomp[4] % 4 )) -eq 0 ]; then + elif [ $M -gt 0 ] && [ ${scomp[3]#0} -eq 1 ] && [ $(( ${scomp[4]#0} % 4 )) -eq 0 ]; then M=$(( M-1 )) echo "KEEP; M: $M" - elif [ $Y -gt 0 ] && [ ${scomp[3]} -eq 1 ] && [ ${scomp[4]} -eq 4 ]; then + elif [ $Y -gt 0 ] && [ ${scomp[3]#0} -eq 1 ] && [ ${scomp[4]#0} -eq 4 ]; then Y=$(( Y-1 )) echo "KEEP; Y: $Y" else