logan_2023/day1/day1p1.sh
2023-12-02 23:09:26 -07:00

14 lines
215 B
Bash
Executable file

#!/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 < input
echo $SUM