logan_2023/day1/day1p1.sh

14 lines
214 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 < "$1"
echo $SUM