I have made the following, but it still boots me back out to me shell..
# ! /bin/bash
expect << EOcmds
spawn telnet tel.myhost.net
expect "ogin:"
send "mylogin\n"
expect "word:"
send "mypass\n"
interact
EOcmds
I have tried changing a couple things, such as /bin/bash to /bin/sh or
/usr/bin/expect, adding another expect to expect the prompt, but none of
this seems to help. Any others idea? Thanks!
Bryan
On Thu, 14 May 1998, Mike A. Lewis, CNE wrote:
|
|At the point in your script where you want to take control, put the
|expect command "interact" as in the example below:
|
|spawn telnet some.isp.com NN
|expect "some string you expect "
|send "my reply string"
|expect "some string you expect"
|send "my reply string"
|expect "some string you expect"
|interact
|
|Hope that answers your question,
|Mike
|
|-----Original Message-----
|From: GateKeepeR News [mailto:[EMAIL PROTECTED]]
|Sent: Thursday, May 14, 1998 2:40 AM
|To: Fred Lenk
|Subject: Re: expect? (offtopic)
|
|Well, it seems to work at first, but it closes the telnet session.. How
|do I get it to just stop and let me do what I want to do?
|
|
|On Wed, 13 May 1998, Fred Lenk wrote:
|
||Well, I use expect in my dialup email server, but not to establish
||the connection. I'm using the following to dialup:
||
||#PPP command with built in chat script
||/usr/sbin/pppd connect '/usr/sbin/chat -v "" ATZ OK AT\&F1 OK
||ATDT1-nnn-nnn-nnnn CONNECT "" ogin: your_login_id word: your_password'
||/dev/modem 115200 crtscts modem lock noipdefault kdebug 0
||
||Note that my emailer has broken up the original single line, starting
||with /usr/sbin/pppd, into several lines. yours must be all one line
||in the shell script. This gets my foot in the door of my ISP, but not
||necessarily to a telnet prompt.
||
||
||Then a little later in the script, I use expect to telnet to the
||host on a non standard telnet port (NN) to accomplish my objectives.
||I've modified it a bit so as to not give out passwords or the host
||I'm dealing with, or what im doing.
||
||expect << EOcmds
|| spawn telnet some.isp.com NN
|| expect "some string you expect "
|| send "my reply string"
|| expect "some string you expect"
|| send "my reply string"
|| expect "some string you expect"
|| send "quit\n"
||
||EOcmds
||
||let me know if that helps
||fred
||
||
||> Date: Wed, 13 May 1998 02:50:29 -0700
||> From: "Gate News" <[EMAIL PROTECTED]>
||> To: <[EMAIL PROTECTED]>
||> Subject: expect? (offtopic)
||
||> Would anyone happen to have a script that automaticall logs into a
||> machine via telnet? I would like to have to so I click my icon, and
|it
||> just connects and logs in.. I was told to use expect but I cant quite
||> get it to work..
||>
||> Also, does anyone know of a way to import a larg number of users
||> (~700) into linux users? instead of adduser/passwd <user> for
||> everyone?
||>
||> TIA
||>
||> Bryan
||>
||>
||Fred Lenk, SysAdmin, CommPower
||mailto:[EMAIL PROTECTED]
||http://www.commpower.com - Check jobs posting.
||
|
|
|--
| PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST
|ARCHIVES!
|http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips
|/mailing-lists
| To unsubscribe: mail [EMAIL PROTECTED] with
| "unsubscribe" as the Subject.
|
|
|--
| PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
|http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
| To unsubscribe: mail [EMAIL PROTECTED] with
| "unsubscribe" as the Subject.
|
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.