+#!/usr/bin/env bash
+# Depends: BK-2020-03: mw_create_month_journal.sh
+# Version: 0.0.1
+
+# update each run
+path_cmj="$HOME/git-OC/BK-2020-03..bkexdev/user/mw_create_month_journal.sh";
+year_start="1582";
+year_end="2100";
+
+# plumbing
+dir_out="./wikicode/";
+
+yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
+die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
+must() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
+check_depends() {
+ # check location of `mw_create_month_journal.sh`
+ if [[ ! -f "$path_cmj" ]]; then die "FATAL:Not found:$path_cmj"; fi;
+};
+check_plumbing() {
+ if [[ ! -d "$dir_out" ]]; then
+ yell "STATUS:Creating missing dir_out:$dir_out";
+ mkdir -p "$dir_out"; fi;
+};
+main() {
+ check_depends;
+ check_plumbing;
+
+ while read -r year; do
+ while read -r month; do
+ monthp="$(printf "%2d" "$month")";
+ # Define and execute create monthly journal command
+ cmj_args+=("$year");
+ cmj_args+=("$month");
+
+ # Define output file path
+ path_out="$dir_out"/"$(printf "%d-%02d" "$year" "$month")";
+
+ # Execute
+ "$path_cmj" "${cmj_args[@]}" > "$path_out";
+
+ unset cmj_args;
+ done < <(seq 1 12); # each month
+ done < <(seq "$year_start" "$year_end"); # each year
+};
+
+main "$@";
+
+# Author: Steven Baltakatei Sandoval
+# License: GPlv3+