--- /dev/null
+#!/bin/bash
+
+# read the file straight in for gits and shiggles
+declare -a data
+read -a data -d $'\0' < input.txt
+
+echo "Got ${#data[*]} records"
+
+for a in $(seq 0 $((${#data[*]}-2))); do
+ for b in $(seq $((a+1)) $((${#data[*]}-1))); do
+ if [ $((${data[$a]} + ${data[$b]})) -eq 2020 ]; then
+ echo "Match found: ${data[$a]} + ${data[$b]} = 2020"
+ echo "Multiplied: $((${data[$a]} * ${data[$b]}))"
+ exit 0
+ fi
+ done
+done
--- /dev/null
+#!/bin/bash
+
+# read the file straight in for gits and shiggles
+declare -a data
+read -a data -d $'\0' < input.txt
+
+echo "Got ${#data[*]} records"
+
+for a in $(seq 0 $((${#data[*]}-3))); do
+ progress=$(($((a * 100)) / ${#data[*]}))
+ echo -ne "\r${progress}% through"
+ for b in $(seq $((a+1)) $((${#data[*]}-2))); do
+ for c in $(seq $((a+2)) $((${#data[*]}-1))); do
+ if [ $((${data[$a]} + ${data[$b]} + ${data[$c]})) -eq 2020 ]; then
+ echo -e "\r100% done "
+ echo "Match found: ${data[$a]} + ${data[$b]} + ${data[$c]} = 2020"
+ echo "Multiplied: $((${data[$a]} * ${data[$b]} * ${data[$c]}))"
+ exit 0
+ fi
+ done
+ done
+done