0
0
mirror of https://github.com/tj/n.git synced 2024-11-29 13:52:34 +01:00
This commit is contained in:
JunJian Zheng 2015-10-16 21:30:55 +08:00
parent 1388dd0926
commit 8582e0e7e2

8
bin/n
View File

@ -359,10 +359,18 @@ erase_line() {
is_ok() {
if command -v curl > /dev/null; then
if $GET -Is $1 | head -n 1 | grep '3..' > /dev/null; then
is_ok $GET -Is $1 | grep Location | awk -F ': ' '{print $2}'
else
$GET -Is $1 | head -n 1 | grep 200 > /dev/null
fi
else
if $GET -S --spider 2>&1 $1 | head -n 1 | grep 200 > /dev/null; then
is_ok $GET -S --spider 2>&1 $1 | grep Location | awk -F ': ' '{print $2}'
else
$GET -S --spider 2>&1 $1 | head -n 1 | grep 200 > /dev/null
fi
fi
}
#