set -e crosslink(){ flat="$1.flat.html" html="$1.html" cp "$html" "$flat" ruby crosslink.rb "$html" "$flat" } cd "$(cd "$(dirname "$0")" && pwd)" echo "pwd: `pwd`" emacs --batch -l build.el crosslink Things ruby collapse.rb Things.html if which rg; then for i in LF NF; do printf '\033[1mFiles without %s\033[0m\n' "#+$i" sh -xc 'rg \ --ignore-file='$i'.ignore \ -t org -g!diss.org -g!goback.org \ --files-without-match "^#\+'"$i"'$"' || echo None done fi