Thanks to @delitescere there are a few optimisations in v3:
- Follow redirects
- Remove need for head and awk getting status code.
- Use scan_text variable in grep
- Use exit code from grep instead of possibly erroneous (because value wasn't surrounded in quotes) -z test (this error prompted the change)
- Output errors to stderr
- Explicitly exit 0