aoc22

2022 Advent of Code
git clone https://git.parazyd.org/aoc22
Log | Files | Refs

01.sh (205B)


      1 #!/bin/sh
      2 
      3 elves=""
      4 elf=0
      5 
      6 while read -r line; do
      7 	if [ -z "$line" ]; then
      8 		elves="$elves $elf"
      9 		elf=0
     10 		continue
     11 	fi
     12 	elf=$(( elf + line ))
     13 done
     14 
     15 printf "%s" "$elves" | tr ' ' '\n' | sort -n | tail -n1