[英]How can I use the WiFi device connected through bash scripting?
How can I figure out if I have WiFi devices connected to my PC thru bash scripting? 如何通过bash脚本确定是否将WiFi设备连接到PC?
depend() {
before fuse
}
start() {
ebegin "Starting Networking"
/etc/init.d/net.eth0 start
if [ `ping -c 1 192.168.1.1 | grep "Destination Host Unreachable"` ]; then
/etc/init.d/net.eth0 stop
if [ -e /sys/class/net/wlan0 ]; then
/etc/init.d/net.wlan0 start
fi
fi
eend
}
Change according to ur Wlan card name . 根据您的Wlan卡名称进行更改。
this information taken from http://www.linuxquestions.org/questions/linux-general-1/detect-if-a-network-device-is-connected-in-a-bash-script-692824/ 此信息取自http://www.linuxquestions.org/questions/linux-general-1/detect-if-a-network-device-is-connected-in-a-bash-script-692824/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.