|
From: Austin S. <te...@of...> - 2002-03-13 18:21:34
|
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
|