diff --git a/src/compare-with-threshold.sh b/src/compare-with-threshold.sh index 124852b..eeed8c6 100755 --- a/src/compare-with-threshold.sh +++ b/src/compare-with-threshold.sh @@ -5,11 +5,10 @@ compare_with_threshold() { threshold="${2}" file_path="${3}" - result=$((threshold - score)) - if awk -v r="${result}" 'BEGIN {exit !(r < 0)}'; then + if awk -v t="${threshold}" -v s="${score}" 'BEGIN {exit !((t - s) < 0)}'; then log_error "NSFW content detected in ${file_path} with score ${score}." exit 1 - elif awk -v r="${result}" 'BEGIN {exit !(r > 0.3)}'; then + elif awk -v t="${threshold}" -v s="${score}" 'BEGIN {exit !((t - s) > 0.3)}'; then log_info "No NSFW content detected in ${file_path} with score ${score}." else log_warning "${file_path} with score ${score} is close to be considered as NSFW content."