diff --git a/d01.sh b/d01.sh index df37546..75a94d1 100755 --- a/d01.sh +++ b/d01.sh @@ -5,7 +5,7 @@ while read line; do num1="$(echo "$line" | sed -n 's/^[^0-9]*\([0-9]\).*/\1/p')" num2="$(echo "$line" | sed -n 's/.*\([0-9]\)[^0-9]*$/\1/p')" sum=$(( $sum + $num1$num2 )) -done < d01_input.txt +done < "$1" echo "$sum" sum=0 @@ -35,5 +35,5 @@ while read line; do num1="$(echo "$line1" | sed -n 's/^[^0-9]*\([0-9]\).*/\1/p')" num2="$(echo "$line2" | sed -n 's/.*\([0-9]\)[^0-9]*$/\1/p')" sum=$(( $sum + $num1$num2 )) -done < d01_input.txt +done < "$1" echo "$sum"