| 12345678910111213141516171819202122232425262728293031323334353637 | #!/bin/bash
#shellcheck disable=SC1090
. "$(sfpath)" || exit 3
shellfu import pretty
PRETTY_DEBUG=${PRETTY_DEBUG:-true}
usage() {
    mkusage "$@" "URL" \
      --                                                                  \
      "Show errors seen when connecting to URL."                          \
      ""                                                                  \
      "Content is ignored, and instead just errors are printed to stdout" \
      "so that they can be used in notifications, etc.  Errors collected" \
      "include socket errors, TLS/SSL errors and HTTP errors (eg. 404)."  \
      ""                                                                  \
      "Exit status is zero if there WERE errors, one if there were none," \
      "two if this script was used incorrectly and three and more in case"\
      "of other failure circumstances."
}
main() {
    local HtUrl
    while true; do case $1 in
        -*) usage -w "unknown argument: $1" ;;
        *)  break ;;
    esac done
    HtUrl=$1
    test -n "$HtUrl" || usage -w "no URL?"
    curl -fLs "$HtUrl" >/dev/null \
     || echo "URL failed, error status: $?" \
     || grep .
}
main "$@"
 |