[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Multi] Wireless Network Configuration



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Pobega wrote:
>> I used to have the same problem, so I made a very little script for
>> that, you  can see it here[1], even do it is in spanish, I think you can
>> figure it out by just seeing the code.
> 
>> [1]
>> http://alejandro.barcena.com.mx/index.php/blog/show/Conectndome_a_diferentes_access_points.html
> 
> Looks very interesting. I do have a question though; I am not good at
> bash (yet) and nor do I speak Spanish, would it be possible to throw
> together a quick translation of the bash script? I understand the
> /etc/network/interfaces bit, but the bash script is kind of confusing to
> me.
> 
> And can you explain how to use it?
> 
> I'm sorry, I'm kind of a bash newb :)
> 
== Begin of script ==
#!/bin/bash

whichessid=""
available=`iwlist eth2 scanning |grep ESSID | cut -d \" -f2`

# The following 'essid' and 'map' variables are filled up with the
# ones you have at /etc/network/interfaces
# for example:
#     mapping eth2
#       script /usr/local/sbin/which-wlan.sh #<-- this is the location
#                                            #     of this script
#
#        map hotel     eth2-hoteltuxtepec
#             ^essid    ^map

while read essid map
do
   if [ "$whichessid" ]
   then
      continue
   fi

   if [[ -n `echo $available |grep $essid` ]]
   then
      whichessid=$map
   fi
done
if [ "$whichessid" ]
then
   echo $whichessid
   exit 0
fi
exit 1
== End of Script ==

I hope this helps.

- --
Alejandro Bárcena Campos

Linux don't need no steenkin' viruses. The users can destroy the
system all by themselves....
                -- Peter Dalgaard in comp.os.linux.misc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGGyJHpZP6bMridNYRAoX2AKCiWY5BPaLWeGo4aeTY6br4ybubTgCgjopU
bTVLoKjkB5eStxkaS9UM5IE=
=o+DV
-----END PGP SIGNATURE-----



Reply to: