toaravind has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use File::Copy; use Expect; my $timeout = '320'; my $current = qx{pwd}; my $NB = 'NetBackup_7.6.0.1_CLIENTS2.tar.gz'; my $patch = 'NB_CLT_7.6.0.2_Patch.tar'; my $patchtar = `/bin/tar -xf $patch`; chdir("/app"); my $exp = Expect->spawn("./NB_update.install -s"); $exp->expect($timeout, [ qr/Enter pack name \(or q\) \[q\]:\s+/ => sub { $exp->send("NB_CLT_7.6.0.2\r"); exp_continue; } ], [ qr/Do you want to kill all NetBackup daemons\? \[y,n\] \(y\) +\s+/ => sub { $exp->send("\r"); exp_continue; } ], [ qr/Do you want to continue the install\? \[y,n\] \(n\)\s+/ = +> sub { $exp->send("y\r"); exp_continue; } ], [ qr/Enter pack name \(or q\) \[q\]: \(q\)\\s+/ => sub { $exp->send("\r"); exp_continue; } ], [ qr/Do you want to restart all NetBackup daemons\? \[y,n\] \( +y\)\s+/ => sub { $exp->send("\r"); exp_continue; } ], ); $exp->soft_close(); chdir("../");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help on expect
by hdb (Monsignor) on Feb 20, 2015 at 13:49 UTC | |
|
Re: Need help on expect
by Anonymous Monk on Feb 20, 2015 at 13:00 UTC | |
by Anonymous Monk on Feb 20, 2015 at 13:02 UTC | |
by hdb (Monsignor) on Feb 20, 2015 at 14:00 UTC | |
by Anonymous Monk on Feb 20, 2015 at 14:05 UTC | |
by toaravind (Initiate) on Feb 25, 2015 at 08:48 UTC | |
|
Re: Need help on expect
by Anonymous Monk on Feb 20, 2015 at 13:19 UTC | |
|
Re: Need help on expect
by Anonymous Monk on Feb 20, 2015 at 14:43 UTC | |
by toaravind (Initiate) on Feb 22, 2015 at 04:57 UTC | |
by Anonymous Monk on Feb 23, 2015 at 15:44 UTC | |
by toaravind (Initiate) on Feb 25, 2015 at 08:43 UTC | |
|
Re: Need help on expect
by toaravind (Initiate) on Feb 25, 2015 at 08:51 UTC |