- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- help with expect script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 11:24 PM
08-23-2005 11:24 PM
help with expect script
#!/usr/local/bin/expect -f
set host [ exec cat hostlist ]
set send_slow {1 .1}
set pass
send "rlogin $host -l
expect "Password: "
send "$pass\r"
send "exit"
When I run this in debug mode, I get the following error:
expect: does "" (spawn_id 0) match glob pattern "Password: "? no
Any assistance would be greatly appreciated! Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 11:43 PM
08-23-2005 11:43 PM
Re: help with expect script
Try this;
#!/usr/local/bin/expect -f
set host [ exec cat hostlist ]
set send_slow {1 .1}
set pass
send "rlogin $host -l
expect {*word:}
send "$pass\n"
send "exit\n"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2005 11:59 PM
08-23-2005 11:59 PM
Re: help with expect script
I have now replaced the line
expect "Password: "
with
expect ""
and the call now seems to suceed (ie, it reports a match). But this has still not acheived what I intend for the script, so further assistance required!
I will explain what I am trying to achieve. I have a NIS+ account that has been reset. The username has a .rhosts file on all systems so that it can perform an rcp without the password being required. However, since the account was reset, you need to rlogin with the password initially before this can happen (reports account disabled until this is done).
Is using expect the best way to achieve this? Is there further debugging (other than the -d in the shell path) that I can implement to check whether the script is succeeding?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2005 12:10 AM
08-24-2005 12:10 AM
Re: help with expect script
Chek this link it may help you further , making the script with expect.
http://www.cpqlinux.com/expect.html
And good example included.
Cheers,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2005 01:28 AM
08-24-2005 01:28 AM
Re: help with expect script
send "rlogin $host -l
to
spawn rlogin $host -l
and re-implemented the
expect "Password:"
line.
This has worked!
Being an expect newbie, I don't know why. If anyone can explain this behaviour to me, that would be great.
Thanks for the responses so far.