Re: [PBML] Enter info after seeing certain prompt
- On Thu, 2004-09-30 at 21:43, Jonathan Chen wrote:
> Yes. There is a module for it. I was hoping that with someone's helpcat /etc/redhat-release
> of writing a module similar to the one on cpan would help me do
> similar things when writing other programs. I am kinda aware of what
> "Expect" is and want perl to emulate it. I tried to look for "Expect"
> in RH 7 and RH9 and there is no such program.
Red Hat Linux release 9 (Shrike)
/msa3530> which expect
expect is /usr/bin/expect
Guess you didn't install all of Red Hat.
>Got a good website to help me with password solution? I am thinkingAre you using openssh?
>of a temporarily solution till someone figures out how do the "Expect"
> like scripting with PERL. Perl is what I want to master. =)
1. Generate private / public keypair on source host with ssh-keygen command.
2. Copy public key to target server, put in a file called authorized_keys in the $HOME/.ssh/ directory.
3. On source server, run "ssh targetserver date" to test it, where targetserver is the target server.
This should get you set up to not require a password: if it doesn't work, then your ssh server config needs tweaking. This would be odd, as most of the time the default config will allow for this behavior. Note that for this setup, you still need whatever passphrase is on the private key. If you create the key without a passphrase, then you can get in without any interaction at all.
As for the Perl / Expect thing, you could always download the Expect module from the CPAN and look at how it does whatever it does. However, if you want to master Perl, then one of the first steps is realizing that if someone has made a module to do something difficult, use theirs. Reinventing the wheel is typically more trouble than it's worth. For learning purposes, I got more value out of the O'Reilly books (especially Randal's books, and the Cookbooks) and writing small programs using them as references than anything else.
Hope this helps somewhat,
IT Programmer Analyst
Saskatchewan Government Insurance
Ph (306) 751-1795
This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the named addressee, please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that using, disclosing, copying or distributing the contents of this information is strictly prohibited.