cw1592
asked on
get the output from a remote site via Expect
I need to get the output from a Exepct send command and then process the output, but couldn't find a good way to do it.
More precisely, I have:
========================== ====
$exp->send("ls\n");
my $ls = $exp->expect(20);
for (split /\n/, $ls ){
print "$_";
}
========================== =
It seems to me that the $ls contains no entry at all; help, anyone?
More precisely, I have:
==========================
$exp->send("ls\n");
my $ls = $exp->expect(20);
for (split /\n/, $ls ){
print "$_";
}
==========================
It seems to me that the $ls contains no entry at all; help, anyone?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
post all of your code, and we can take a look
ASKER
I guess the code from shanikawm is working, it is just the format looks different from I expected. Thanks.
ASKER
I run the code and still see anything.
btw, I didn't mention that the $exp is using the sftp; not sure this will make thing different. is the output from ls (via Expect) going into tty? or std out?