AdventOfCode/2021/day1/day1.sh

26 lines
467 B
Bash
Executable File

#!/bin/bash
count=0
grow=0
prev=0
while IFS= read -r line; do
echo $count $grow $prev
if [ $count -eq 0 ]; then
echo "This is the first line, we skip it (prev="$prev", line="$line")"
prev=$line
echo "prev=$prev, line=$line"
else
if [ $line > $prev ]; then
echo $count": "$line" > "$prev
((grov++))
prev=$line
fi
fi
((count++))
done < day1_test.txt
echo "I can through $count lines"
echo "I found $grov depth measurement increases"