more fail

This commit is contained in:
Tom Bloor 2024-12-19 17:54:18 +00:00
parent f45028d04d
commit 9735026df8
No known key found for this signature in database
GPG key ID: 8775E856E2754827

View file

@ -59,7 +59,7 @@ while read -r l; do
# start with the first val
prev_val="${line_split[0]}"
is_safe=1
is_safe=2
# if positive, going up, if negative, going down!
is_up_down="$((line_split[1] - line_split[0]))"
@ -83,12 +83,11 @@ while read -r l; do
if [[ "${test_is_safe}" -eq 0 ]]; then
# normally we fail this set
is_safe=0
is_safe=$((is_safe - 1))
fi
if [[ "${test_is_safe}" -eq 0 ]] && [[ "${safety_trigger}" -eq 1 ]]; then
# but we let 1 happen if the trigger hasnt... triggered
is_safe=1
safety_trigger=0
if [[ "${idx}" -eq 1 ]]; then
# we may have to re-calculate is_up_down!
@ -104,13 +103,9 @@ while read -r l; do
fi
done
if [[ "${is_safe}" -eq 0 ]]; then
echo "final check unsafe"
else
echo "final check safe"
if [[ "${is_safe}" -gt 0 ]]; then
safe_count=$((safe_count + 1))
fi
echo ""
safe_count=$((safe_count + is_safe))
done <"$FILE_IN"
echo "final safe count ${safe_count}"