Make all scripts able to take a file name, merge parts 1 and 2 of lanternfish in...
[advent-of-code-2021.git] / day01 / count.sh
index 990433db1ae9f939fb8e4769f126cf6d19903435..86a89b1900fbd7aadce5f281b5f9016b7e815485 100755 (executable)
@@ -9,7 +9,9 @@ cur_window=1
 
 declare -a windows
 
-for num in $(<input.txt); do
+filename="${1:-input.txt}"
+
+for num in $(<"$filename"); do
     cur_line=$((cur_line+1))
     windows[$cur_window]=$num
     if [ $cur_window -gt 1 ]; then