]> git.sommitrealweird.co.uk Git - advent-of-code-2021.git/blobdiff - day01/count.sh
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
old mode 100644 (file)
new mode 100755 (executable)
index 990433d..86a89b1
@@ -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