LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 11-18-2004, 10:37 PM   #1
reitzell
LQ Newbie
 
Registered: May 2004
Posts: 17

Rep: Reputation: 0
expect question


I had to change like 40 devices SNMP community strings. I had a file of all of the devices called iplist that simply had the IP addresses listed 1 on each line. I was thinking I could simply “for foo in `cat iplist`; do snmpwork $foo; done but I ran into a little problem.

#!/usr/bin/expect –f

proc show-snmp {gateway user password]
spawn telnet $gateway

<snip>

set user robw
set password test

show-snmp [lindex $argv 0] $user $password

This didn’t work but if I spawned telnet and then opened $gateway it did.

#!/usr/bin/expect –f

proc show-snmp {gateway user password]
spawn telnet
expect ">" {send "open $gateway\n"}

<snip>

set user robw
set password test

show-snmp [lindex $argv 0] $user $password

Any idea why?
 
Old 11-20-2004, 09:03 AM   #2
reitzell
LQ Newbie
 
Registered: May 2004
Posts: 17

Original Poster
Rep: Reputation: 0
I think I didn't word this well.

I am going to figure out how to do this kind of thing in perl.

So today, chapt 1 learning perl.

Thanks anyways,
Rob
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Possibly the dumbest question I would ever expect to ask pyrael Linux - General 9 11-22-2005 05:52 AM
A question about expect. imjoe Programming 1 10-26-2005 04:42 AM
expect question deiussum Programming 0 08-05-2005 03:51 PM
Double and single quote, Question in expect evilchild Programming 4 08-22-2004 05:34 PM
"expect" shell beginner question, please help me out yuzuohong Linux - General 1 06-28-2003 01:17 PM


All times are GMT -5. The time now is 04:02 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration