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

Re: Bash script for wireless



> Hi,
> 
> First, sorry if you've read this already, but I mis-posted it in an existing 
> thread instead of as a new one. Here's my question:
> 
> Calling all scripting experts! I'm trying to write a script which will present 
> a list of available wireless networks as a menu, from which the user can 
> select one to connect to.
> 
> I want to take selected parts of the output of `iwlist scan` as variables, but 
> have been unable to find out how to do this in online scripting guides. I 
> know how to use grep etc. to find known bits of output, but not how to 
> isolate arbitrary output, for example ESSID names.

I am no expert, but

iwlist eth1 scan | grep -o 'ESSID\"[^\"]*\"' | while read f ; do echo "{f:6}" ; done

does something, maybe this could be fed into an array and accessed from it

read section "Parameter Expansion" in bash manual page, sure you will find better solution there

maybe awk could be better tool for this, but again, I am no expert...


HAllellujAH
VLP



Reply to: