#!/usr/bin/env sh ROOT="$(git rev-parse --show-toplevel)"; # This results in fd returning relative paths cd "$ROOT/common" || echo "BUG, no root dir!" fd . "." --type file --hidden | while read -r file; do echo "Instantiating '$file'..." fd . "../templates" --type directory --max-depth 1 | while read -r template; do echo " done in '$template'." echo " " cp "$file" "$template$file" rm "$template$file" cp "$file" "$template$file" done done # vim: ft=sh