I am trying this small script with a so called gui 😉 . This helps managing my wireless in the extreme conditions. Just a shell script. Run the script as root otherwise it’ll not work.
Get the script here or copy the code below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #!/bin/bash # # Author - Kulbir Saini, IIIT Hyderabad. # Home - http://saini.co.in/ # KWirelessManger - Just for fun.(It works ... its not just fun). # #Give the popup life. POPUP_LIFE="10" #kdialog --passivepopup "Welcome to 'KWirelessManager'" ${POPUP_LIFE} & #Give your device name for proceeding further. It may be one of wlan0, ra0, eth0, ipw2200 etc... WLAN_DEVICE="wlan0" #Give your WLAN host to be connected. WLAN_HOST="IIIT WLAN" CONNECTED=0 while [[ 1 ]]; do iwlist ${WLAN_DEVICE} scanning 2> /dev/null > /tmp/iwlist.aps grep -e "Cell" /tmp/iwlist.aps | tr " " "\t" | cut -f15 > /tmp/iwlist.apadd ACCESS_POINTS_IN_RANGE=`wc -l /tmp/iwlist.apadd` for ACCESS_POINT_ADDRESS in `cat /tmp/iwlist.apadd` do iwconfig ${WLAN_DEVICE} ap ${ACCESS_POINT_ADDRESS} #kdialog --passivepopup "Connceting to Access Point ${ACCESS_POINT_ADDRESS} ..." ${POPUP_LIFE} & echo "Connceting to Access Point ${ACCESS_POINT_ADDRESS} ..." WLAN_STATUS=`service network restart | tail -1 | grep "FAILED"` if [[ ${WLAN_STATUS} == "" ]]; then #kdialog --passivepopup "You are connected to ${WLAN_HOST}." ${POPUP_LIFE} & echo "You are connected to ${WLAN_HOST}." CONNECTED=1 break else #kdialog --passivepopup "Failed to connect to the Access Point ${ACCESS_POINT_ADDRESS} :(" ${POPUP_LIFE} & echo "Failed to connect to the Access Point ${ACCESS_POINT_ADDRESS} :(" CONNECTED=0 fi done if [[ ${CONNECTED} == 1 ]]; then sleep 180; fi done |
Please suggest any optimization and do tell if u like it.
i tried copy paste your script to file, and test to run, i get errorr like this :
tr: extra operand `“t”’
Try `tr –help’ for more information.
tr: extra operand `“t”’