Hi I am using Expect in perl to connect to remote machine and execute certain functions. sample code is like
$outfile="ls -lrt";
$outfile1="output";
$exp->expect(30,-re,".*bash-.*" => sub{$exp->send("$outfile2 >$outfile \r")});
$exp->expect(60,-re,".*bash-.*" => sub{$exp->send("$shayam > $Ram \r")});
Even if the first expression fails it will wait for 60 sec and will execute the second statement. I just want to make a check that if only the first statement passes it should proceed.