#! /bin/bash template="./pages/template.html" output_directory="./website/" cut_whitespace() { ws="${line%%[![:space:]]*}" # get whitespace and store to ws line="${line#"$ws"}" # remove whitespace from line } pages=() while IFS= read -r line; do pages+=("$line") done < "pages.txt" for page in "${pages[@]}"; do page_content=() output= while IFS= read -r line; do page_content+=("$line\n") done < "./pages/$page" while IFS= read -r line; do cut_whitespace if [[ "$line" == "