projects
/
advent-of-code-2021.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
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
diff --git
a/day01/count.sh
b/day01/count.sh
old mode 100644
(file)
new mode 100755
(executable)
index
990433d
..
86a89b1
--- a/
day01/count.sh
+++ b/
day01/count.sh
@@
-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