#!/bin/sh
while true
do
iwlist eth1 scan > /tmp/wiscan.txt
if `cat /tmp/wiscan.txt | grep -c SSID1` = 1 then
do
iwconfig eth0 ssid SSID1
exit
done
if `cat /tmp/wiscan.txt | grep -c SSID2` = 1 then
do
iwconfig eth0 ssid SSID2
exit
done
sleep 3
done