day 4, part 1

meow
Dominique Liberda 2022-12-09 12:24:27 +01:00
parent 5517832b53
commit 3a7d07f766
1 changed files with 24 additions and 0 deletions

24
04/01.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
# Paula fronting, so we're gonna do things a lil' differently
data="$(cat /tmp/04)"
count=0
while read line; do
IFS=, meow=($line)
IFS=- uwu=(${meow[0]})
IFS=- owo=(${meow[1]})
unset IFS
if [[ ${uwu[0]} -gt ${owo[0]} ]]; then
[[ ${owo[1]} -ge ${uwu[1]} ]] && count=$((count+1))
elif [[ ${uwu[0]} == ${owo[0]} ]]; then
[[ ${owo[1]} -ge ${uwu[1]} || ${uwu[1]} -ge ${owo[1]} ]] && count=$((count+1))
else
[[ ${uwu[1]} -ge ${owo[1]} ]] && count=$((count+1))
fi
done <<< "$data"
echo $count