All of lore.kernel.org
 help / color / mirror / Atom feed
* Simple expect question
@ 2006-11-13 14:22 urgrue
  2006-11-13 15:05 ` Glynn Clements
  0 siblings, 1 reply; 4+ messages in thread
From: urgrue @ 2006-11-13 14:22 UTC (permalink / raw)
  To: linux-admin

I'm trying to make a simple script that will do with telnet what one can
do with ssh when you do "ssh hostname command". iow:
telnet somehost command

then it should, using expect (presumably), telnet into somehost, prompt
me interactively for the username/password, and after successfully
logging in run the command specified on somehost.

As simple as that sounds, I can't figure it out. I've gotten this far
which is probably done all wrong:

#!/usr/bin/expect

spawn telnet [lrange $argv 0 0\n]  #telnet to host given on command line
expect { "login:"
	#how to prompt user interactively for input here?
        "password:"
	#how to prompt user interactively for input here?
	#somehow check for successful login here
        send "[lrange $argv 1 99]" #send command-line args to host
        send "exit\r"
}



any help appreciated.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-11-14 11:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-13 14:22 Simple expect question urgrue
2006-11-13 15:05 ` Glynn Clements
2006-11-13 19:28   ` Freddie
2006-11-14 11:09     ` Glynn Clements

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.