mirror of
https://github.com/notwa/rc
synced 2024-10-31 15:44:36 -07:00
20 lines
433 B
Bash
Executable file
20 lines
433 B
Bash
Executable file
#!/usr/bin/env sh
|
|
# YES_ZSH
|
|
# YES_BASH
|
|
# YES_DASH
|
|
# YES_ASH
|
|
|
|
isup() { ### @-
|
|
### return 0 if a given website returns a 2xx HTTP code.
|
|
###
|
|
### ```
|
|
### $ isup google.com && echo yay || echo nay
|
|
### yay
|
|
### $ isup fdhafdslkjgfjs.com && echo yay || echo nay
|
|
### nay
|
|
### ```
|
|
local c="$(curl -sLI -w '%{http_code}' -o /dev/null "$1")"
|
|
[ -z "${c#2[0-9][0-9]}" ]
|
|
}
|
|
|
|
[ -n "${preload+-}" ] || isup "$@"
|