LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Inserting the results of a command (https://www.linuxquestions.org/questions/programming-9/inserting-the-results-of-a-command-425060/)

moosedaddy 03-15-2006 09:58 AM

Inserting the results of a command
 
I have written a basic script that allows me to select my wired or wireless network on my laptop and if I choose the wireless it let me choose if I want encryption or not.

My laptop has a built in broadcom wireless card and I have just started using the new bcm43xx driver and it requires that I enter the ESSID of the router. Setting the ESSID to any will not work or how could I get it to work.

This is what I need, how can I get the results of "iwlist scan | grep ESSID" and enter that into "iwconfig eth1 essid" so that I will automatically connect to the local essid when I travel.

Thanks

acid_kewpie 03-15-2006 10:15 AM

iwconfig eth1 essid $(iwlist scan | grep ESSID)

moosedaddy 03-15-2006 10:33 AM

Sometimes after I see the answer I feel so dumb.

Thanks acid_kewpie

moosedaddy 03-15-2006 07:37 PM

This works well but, what I get when i run iwconfig is "ESSID:"ESSID:XXXXX"". I probably was not clear because I got just what I ask for.

What I really need is when the command "iwlist eth1 scan | grep ESSID" ir run within a script I get the result I get is "ESSID:"XXXXXX"". I need to end up with the command "iwconfig eth1 essid XXXXXXX"

Thanks

acid_kewpie 03-16-2006 03:23 AM

right, so use cut or something to ditch the first part
Code:

$ echo ESSID:blah | cut -d\: -f2
blah



All times are GMT -5. The time now is 05:42 AM.