1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 04:39:03 -08:00
rc/sh/isup

15 lines
254 B
Text
Raw Normal View History

2014-11-12 20:36:15 -08:00
#!/usr/bin/zsh
2021-07-29 00:37:35 -07:00
# YES_ZSH
# NO_BASH
# NO_DASH
# TODO: damned substrings. rewrite to be semi-portable.
2021-07-29 00:37:35 -07:00
2014-11-12 20:36:15 -08:00
isup() {
local c
curl -sLI -w '%{http_code}' -o /dev/null "$1" | read -r c
[ "${c:0:1}" -eq 2 ]
}
2021-07-29 00:37:35 -07:00
[ "${SOURCING:-0}" -gt 0 ] || isup "$@"