On Saturday 21,April,2012 02:42 AM, David Christensen wrote:
On 04/20/2012 05:42 AM, lina wrote:
I used to ssh Mars (servers's name) and then cd to some directory and
check some file's modification time.
Can I do it locally with perl, without ssh?

A local Perl script will need some way to read the mtime of the file on
the remote host. If you get to the host via SSH, then you're going to
need a Perl SSH module...


As an alternative, you can use ssh from the command line to run a Perl
one-liner on a remote host (p3600) that prints the modification time of
a file (.bashrc):

$ ssh p3600 'perl -e "print(scalar localtime((stat(q(.bashrc)))[9]))"'

Hi David,

Thanks, I didn't realize that the ssh p3600 'do something' can do something without being in the server.



HTH,

Best wishes,

David




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to