Files
advent-bash-2022/4b.sh
2023-12-01 14:20:59 +01:00

18 lines
213 B
Bash
Executable File

#!/usr/bin/env bash
sum=0
while read a; do
IFS=, read x y <<< $a
IFS=- read x1 x2 <<< $x
IFS=- read y1 y2 <<< $y
if [[ $(( (x1 - y2) * (x2 - y1) )) -le 0 ]]; then
let sum++
fi
done
echo $sum