yn() {
  printf '%s [y/N]: ' "$1"
  # enable raw input to allow for a single byte to be read from
  # stdin without needing to wait for the user to press `Return`.
  [ -t 0 ] && stty -echo -icanon
  # read a single byte from stdin using dd(1) POSIX read(builtin(1))
  # has no support for single/'N' byte based input from the user.
  answer=$(dd ibs=1 count=1 2>/dev/null)
  # disable raw input, leaving terminal how we *should* have found it.
  [ -t 0 ] && stty echo icanon
  printf '%s\n' "${answer}"
  # handle the answer here directly, enabling this function's
  # return status to be used in place of checking for '[yY]'
  # throughout this program.
  glob "${answer}" '[yY]'
}

glob() {
  # this is a simple wrapper around a case statement to allow
  # for simple string comparisons against globs.
  #
  # example:
  #     if glob "Hello World" '* World'; then
  #
  # disable this warning as it is the intended behavior.
  # shellcheck disable=SC2254,SC2249
  case "$1" in
    "$2") return 0 ;;
  esac
  return 1
}
