]>
zdv2.bktei.com Git - BK-2020-03.git/blob - user/mw_create_summary_months_range.sh
ca97b06155d7791237db402b530d968b6d1b6776
   2 # Desc: Wrapper for creating yearly journal summary page generation script 
   3 # Input: arg1: path mw_create_summary_months.sh 
   6 # Example: mw_create_summary_months_range.sh ./mw_create_summary_months.sh 2030 2040 
   7 # Depends: BK-2020-03: mw_create_summary_months.sh 
  11 path_gen
="$1"; # eg "$HOME/scripts/mw_create_year_journal.sh" 
  12 year_start
="$2"; # eg 2030 
  13 year_end
="$3"; # eg 2040 
  14 dir_out
="./wikicode/"; 
  16 yell
() { echo "$0: $*" >&2; } # print script path and all args to stderr 
  17 die
() { yell 
"$*"; exit 111; } # same as yell() but non-zero exit status 
  18 must
() { "$@" || die 
"cannot $*"; } # runs args as command, reports args if command fails 
  20     # check location of `mw_create_year_journal.sh` 
  21     if [[ ! -f "$path_gen" ]]; then die 
"FATAL:Not found:$path_gen"; fi; 
  24     if [[ ! -d "$dir_out" ]]; then 
  25         yell 
"STATUS:Creating missing dir_out:$dir_out"; 
  26         mkdir 
-p "$dir_out"; fi; 
  32     while read -r year
; do 
  35         # Define output file path 
  36         path_out
="$dir_out"/"$(printf "Summary_of_months_of_
%d
" "$year")"; 
  39         "$path_gen" "${gen_args[@]}" > "$path_out"; 
  42     done < <(seq "$year_start" "$year_end"); # each year 
  47 # Author: Steven Baltakatei Sandoval