#! /bin/bash output='TRANSATLANTICISM Music Reviews\n

/ TRANSATLANTICISM / Music Reviews

\n
\n

below is a list (in no particular order) of albums that i enjoyed enough to write a short blurb about.

\n' cd "./album_reviews/" file_paths=() inverted_file_paths=() list= originalIFS="$IFS" IFS="-" for file in *.txt; do index_name_array=($file) file_paths[$((2#${index_name_array[0]}))]="$file" list+="${index_name_array[1]}, " done while (( ${#file_paths[@]} > 0 )); do inverted_file_paths[${#file_paths[@]}]+="${file_paths[0]}" unset 'file_paths[0]' file_paths=("${file_paths[@]}") done # get length of original array # set index 0 of original array to the index matching the length of the original array # unset index 0 of the original array IFS="$originalIFS" for file in "${inverted_file_paths[@]}"; do content=() while IFS= read -r line; do content+=("$line") done < "$file" # Load each line as a new object into an array html="

${content[0]}

by ${content[1]} | ${content[2]} | ${content[3]}" if (( ${#content[@]} > 6 )); then html+=" | Bandcamp" fi html+="

${content[4]}

Favourite Track - \"${content[5]}\"

" output+="$html\n" done output+="
" echo "built album pages: $list" echo -e "$output" > "../pages/musicreview.html"