#!/bin/bash [ "$HOSTNAME" != lime2 ] || exit 1 echo "Pulling procedures-tssr..." awk -v header="$(<./header.html)" '{sub(/===HEADER===/,header)} 1' ./procedures-tssr/index.template.html | awk -v footer="$(<./footer.html)" '{sub(/===FOOTER===/,footer)} 1' > ./procedures-tssr/index.tmp.html for folder in ~/tssr/procedures/*; do if [ -d "$folder" ]; then name=$(basename "$folder") display_name=$(echo "$name" | sed -E 's/procedure_//g; s/_202.+//g; s/-/ /g; s/_/ /g') if [[ "$name" = *chose* ]]; then # ignore procedure_chose echo "ignoring $name" else echo "found $name" origin_file_time=$(stat -c %Y "$folder"/procedure*.pdf) current_file_time=$(stat -c %Y ./procedures-tssr/procedure_"$name".pdf) if [ "$origin_file_time" -gt "$current_file_time" ]; then cp "$folder"/procedure*.pdf ./procedures-tssr/procedure_"$name".pdf else echo "Already up to date" fi sed -i "s@===PROCEDURE===@