Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
sub run_command { my ($in_prompt,$in_command)=@_; print $rlogin "$in_command\r"; $rlogin->expect(300,'-re',$in_prompt); }#end run_command sub rlogin { my ($in_hostname,$in_password,$in_prompt,$in_type)=@_; $rlogin=Expect->spawn($in_type." ".$in_hostname); $rlogin->expect(300,"ssword:") || die "Never got password prom +pt on $host, ".$rlogin->exp_error()."\n"; print $rlogin "$in_password\r"; $match=$rlogin->expect(300,"closed by foreign host","-re",$in_ +prompt); #Used for debugging I think #die "Dumped by server\n" if $match == 1; #die "Never got shell prompt on $host, ".$rlogin->exp_error(). +"\n" unless $match; }#end rlogin rlogin($hostname,$password,$prompt,"ssh"); run_command($prompt,"export ORACLE_SID=$oracle_sid"); run_command($prompt,"cd dev"); run_command($prompt,"chmod +x *"); run_command($prompt,"exp $schema/$schema file=$file log=$log rows=no") +; run_command($prompt,"imp $schema/$schema file=$file indexfile=$indexfi +le full=y"); run_command($prompt,"./initial.pl ".$schema."_tabind LOC_".$touser." +$touser $schema ");
Edit 2001-26-06 Masem - Added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl expect prompt
by TheoPetersen (Priest) on Jun 27, 2001 at 00:37 UTC |