Quote Originally Posted by djyoung4 View Post
no problem. let me know if you do anything interesting with it. I'm tryin to write a script using that which will put the connected network in green and the "open" networks in red. just having problems getting iwlist to run in a script
Hmmmmm..... I've been looking at it for a while today and I glued some pieces together from other scripts I've ever wrote... and now I'm amazed by how ugly this has become: (kind of a bash-frankenstein monster)

Code:
#!/bin/bash
num=`exec sudo iwlist wlan0 scan | grep -c "Cell"`
list=`exec sudo iwlist wlan0 scan`
for (( i=1; i<=$num; i++ ))
do
	if [ "$i" -lt "10" ]
	then
		ogr='0'$i
	else
		ogr=''$i
	fi
	
	if [ "$[i+1]" -lt "10" ]
	then
		bgr='0'$[i+1]
	else
		bgr=''$[i+1]
	fi
	line=`exec echo $list | sed "s/^.*Cell $ogr - //g;s/Cell $bgr - .*//"`
	ssid=`exec echo $line | sed "s/^.*ESSID:\"//g;s/\" Protocol.*//"`
	mode=`exec echo $line | sed "s/^.*Mode://g;s/ Channel.*//"`
	if [ "$mode" == "Master" ]
	then
		mod2='M'
	elif [ "$mode" == "Managed" ]
	then
		mod2='m'
	else
		mod2='A'
	fi
	
	if [ "`exec echo $line | sed "s/^.*Encryption key://g;s/ Bit Rates:.*//"`" == "on" ]
	then
		sec2='s'
	else
		sec2=' '
	fi
	
	qual=`exec echo $line | sed "s/^.*Quality=//g;s/\/100 Signal.*//"`
	echo $mod2 $sec2 $qual"%" $ssid
done
exit
I hope you'll be able to take off (again) with this...