logan_2023/day1/day1p1.sh

15 lines
214 B
Bash
Raw Normal View History

2023-12-03 01:09:26 -05:00
#!/bin/bash
SUM=0
while read f; do
TEMP1="$(echo ${f//[a-z]})"
TEMP2="${TEMP1:0:1}${TEMP1:0-1}"
for i in $TEMP2; do
echo $SUM + $i
SUM=$(( $SUM + $i ))
done
done < "$1"
2023-12-03 01:09:26 -05:00
echo $SUM