#!/bin/bash
wget -q --tries=10 --timeout=20 --spider http://www.baidu.com
if [[ $? -eq 0 ]]; then
echo "Online"
else
echo "Offline"
fi
Check internet access using bash
最新推荐文章于 2023-12-21 20:36:40 发布
#!/bin/bash
wget -q --tries=10 --timeout=20 --spider http://www.baidu.com
if [[ $? -eq 0 ]]; then
echo "Online"
else
echo "Offline"
fi