vitaly has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Dialog with UNIX shell
by zentara (Cardinal) on Jul 20, 2007 at 11:50 UTC
    Net::SSH2 is the preferred module now, see A little demo for Net::SSH2, but here is an old sshopen2 idea
    #!/usr/bin/perl # to login to work machine, rewrite /$home/etc/hosts entry use strict; use warnings; use Net::SSH qw(sshopen2); my $ppp0 = `/sbin/ifconfig ppp0`; die "Invalid output from ifconfig! Received: $ppp0\n" unless ($ppp0 =~ m/(\d+\.\d+\.\d+\.\d+)/); my $ip = $1; my $user = "jrak"; my $host = "mail.myhost.org"; my $cmd = "perl -pi -e 's/^\\d+\\.\\d+\\.\\d+\\.\\d+\thome/$ip\thome/ +' /home/jrak/etc/hosts"; sshopen2( "$user\@$host", *READER, *WRITER, "$cmd" ) or die "ssh: $!"; while (<READER>) { print $_; } close(READER); close(WRITER);

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Dialog with UNIX shell
by ikegami (Patriarch) on Jul 19, 2007 at 20:24 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.