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

时间:2009-07-22 08:02:22

标签: bash shell

如何判断我是否通过bash脚本将WiFi设备连接到我的PC?

  • 除了'iwconfig'之外还有吗?
  • 假设我连接了两台设备,并且正在使用设备A.现在,如果是设备A. 关闭,如何设置使用设备B?

1 个答案:

答案 0 :(得分:-2)

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
}

根据您的Wlan卡名称进行更改。

此信息取自http://www.linuxquestions.org/questions/linux-general-1/detect-if-a-network-device-is-connected-in-a-bash-script-692824/

相关问题