#!/usr/bin/env -S nix shell nixpkgs#bash nixpkgs#sqlite --command bash main() { local count=1 local double_answer=false printf "Question Solutions\n" printf "==================\n" while IFS= read -r line; do # This is an ugly hack, but I'm too lazy to do this "right". Question 4 has two possible # answers based on your interpretation, thus I am outputting two answers for question 4 by # doing this fugly stuff. if ((count == 5)) && ! $double_answer; then ((count--)) double_answer=true fi printf "%d: %s\n" $((count++)) "${line}" done < <(sqlite3 db.sqlite3 <./cmds.sql) } main "${@}"