LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-15-2006, 08:58 AM   #1
moosedaddy
Member
 
Registered: Feb 2003
Location: Oklahoma
Distribution: Debian Unstable
Posts: 244

Rep: Reputation: 30
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
 
Old 03-15-2006, 09:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
iwconfig eth1 essid $(iwlist scan | grep ESSID)
 
Old 03-15-2006, 09:33 AM   #3
moosedaddy
Member
 
Registered: Feb 2003
Location: Oklahoma
Distribution: Debian Unstable
Posts: 244

Original Poster
Rep: Reputation: 30
Sometimes after I see the answer I feel so dumb.

Thanks acid_kewpie
 
Old 03-15-2006, 06:37 PM   #4
moosedaddy
Member
 
Registered: Feb 2003
Location: Oklahoma
Distribution: Debian Unstable
Posts: 244

Original Poster
Rep: Reputation: 30
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
 
Old 03-16-2006, 02:23 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
right, so use cut or something to ditch the first part
Code:
$ echo ESSID:blah | cut -d\: -f2
blah
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
results of move command with * whansard Linux - General 3 06-09-2004 03:03 PM
Executing commands and getting command results. xconspirisist Programming 2 03-11-2004 02:52 PM
Odd results from df command avantman42 Linux - General 0 11-17-2003 10:01 AM
Results from top command...user Q...? cbjhawks Linux - Software 1 09-20-2003 10:06 PM
Inserting modules wgodois Linux - Hardware 0 08-03-2003 09:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration