Created
September 14, 2013 06:06
-
-
Save masayuki5160/6559227 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Net::OpenSSH; | |
use strict; | |
use warnings; | |
my $host = "hostname"; | |
# ログイン認証 | |
my $ssh = Net::OpenSSH->new( | |
$host, | |
( | |
user => 'loginUser', | |
password => 'pass', | |
port => '22', | |
), | |
); | |
# 指定コマンドの実行とキャプチャの取得 | |
my @ls = $ssh->capture("ls -l"); | |
$ssh->error and die "remote ls command failed: " . $ssh->error; | |
print @ls; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment