From 02da3cf54d329128d755d94d8ada68bb52920143 Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 5 Dec 2024 23:31:27 +0800 Subject: [PATCH] Rename to make more sense --- 2024/day-5/solution-2.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2024/day-5/solution-2.sh b/2024/day-5/solution-2.sh index 5c88056..be100e7 100644 --- a/2024/day-5/solution-2.sh +++ b/2024/day-5/solution-2.sh @@ -4,7 +4,7 @@ while read -r LINE do GREP_EXPR=$( printf "%s" "$LINE" | tr ',' '|' ) - PASS_RULES=0 + MATCH_COUNT=0 # Loop through rules and find a breaking rule while read -r RULE do @@ -12,14 +12,14 @@ if [[ $GREPC -ne 1 ]] then #printf "%s rule violated for %s \n" "$RULE" "$LINE" - PASS_RULES=1 + MATCH_COUNT=1 break fi # Filter rules that only has included pages done <<< "$( < input-rules grep -E "($GREP_EXPR)\\|($GREP_EXPR)" | sed 's/|/,.*/')" # Don't process for valid lines - [[ $PASS_RULES -eq 0 ]] && continue + [[ $MATCH_COUNT -eq 0 ]] && continue printf "%s\n" "$LINE" done < input-updates