#!/usr/bin/bash
# experiment in replacing heredoc with completely bash-internal functionality
# replacing code such as this which executes the external 'cat' binary:
# cat <<-EOT
# part of
# a heredoc
# EOT

NO=1
YES=0

usage() {
 local start="$NO"
 while read -r line; do
  [[ "${line// }" = "SOT" ]] && start="$YES" && continue
  [[ $start -eq $NO ]] && continue
  [[ "${line// }" = "EOT" ]] && return
  eval echo "$line"
 done <"$0"
SOT
usage: $0 1 2 3 4
  some info
  some more info
  yet more info
EOT
}

usage
