mirror of
https://github.com/tj/n.git
synced 2024-11-29 13:52:34 +01:00
Update n
This commit is contained in:
parent
1388dd0926
commit
8582e0e7e2
12
bin/n
12
bin/n
@ -359,9 +359,17 @@ erase_line() {
|
||||
|
||||
is_ok() {
|
||||
if command -v curl > /dev/null; then
|
||||
$GET -Is $1 | head -n 1 | grep 200 > /dev/null
|
||||
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
|
||||
$GET -S --spider 2>&1 $1 | head -n 1 | grep 200 > /dev/null
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user