Skip to content

Instantly share code, notes, and snippets.

@masayuki5160
Created September 14, 2013 06:06
Show Gist options
  • Save masayuki5160/6559227 to your computer and use it in GitHub Desktop.
Save masayuki5160/6559227 to your computer and use it in GitHub Desktop.
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