]> git.sommitrealweird.co.uk Git - advent-of-code-2021.git/blobdiff - day01/count.sh
Day 16 pt 1 - doesn't actually stack packets hierarchically - just parses the headers
[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
 
 
 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
     cur_line=$((cur_line+1))
     windows[$cur_window]=$num
     if [ $cur_window -gt 1 ]; then