#!/usr/bin/env bash expand() { TITLE="$1" cat <<-"EOF" EOF echo " $TITLE" cat <<-"EOF"
EOF cat cat <<-"EOF"
EOF } if [ -z "$1" ]; then echo "Missing page title" exit 1 fi if [ -z "$2" ] && [ -t 0 ]; then echo "Missing page body" exit 1 fi if [ ! -t 0 ]; then expand "$1" exit 0 fi expand "$1" < "$2"