|
From: <al....@ac...> - 2002-03-13 20:05:05
|
Austin,
Thank you. Your comments worked. Now I can see the remote file size on my
screen. I need to assign
that value to a variable so that I can compare it against the size of my
other files. How can I assign the
returned value to a local variable?
Al
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Al Pashazadeh
Accenture
CIO Technology Services - Network Services
Dallas, Infomart
Phone: (214) 672-4255 VPN: 573-4255
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Austin Schutz
<te...@of...> To: al....@ac...
cc: exp...@li...
03/13/2002 12:20 PM Subject: Re: [Expectperl-discuss] Need Help with Capturing Output
On Wed, Mar 13, 2002 at 12:05:50PM -0600, al....@ac...
wrote:
> Hello,
>
> I am using perl 5.6 with Expect module 1.12 and trying to get the size of
a
> file on a remote server.
> I tried piping the output of ls -l on the remote server to awk but that
> only returned the output of the ls -l
> commend. I searched the archived messages and noticed that this issue
was
> reported as a bug.
> Does anyone knows if this bug is fixed? For now, I created a short
script
> on the remote server to
> display the size of the file. The scritpt works fine when it is excuted
> from within the spawned ssh
> but I am not sure how to capture its output. I need to compare the
> returned value (from my script)
> against the size of a similar file on the local server. Any help is
> appreciated.
>
>
#!/usr/bin/perl
use Expect;
$ssh = Expect->spawn('ssh host.com');
$ssh->expect(60,"d: ");
print $ssh 'password' . "\n";
$ssh->expect(60,'> ');
print $ssh 'ls -l | awk \'{print $5}\''."\n";
$ssh->expect(60,'> ');
I dunno, works for me.
Austin
This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete the
original. Any other use of the email by you is prohibited.
|