简体   繁体   English

如何使用通过bash脚本连接的WiFi设备?

[英]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?

  • Is there anyway aside from 'iwconfig'? 除了“ iwconfig”以外,还有其他内容吗?
  • Suppose I have two devices connected and am using device A. Now if device A is down, how can I setup to use device B instead? 假设我有两个连接的设备,并且正在使用设备A。现在,如果设备A处于关闭状态,如何设置使用设备B?
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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM