1
use Net::SSH2;
my $ssh2 = Net::SSH2->new();
$ssh2->connect($hostname);
$ssh2->auth_password($user,$pass);
$chan = $ssh2->channel();
$chan->exec("cd dir1");
$chan->exec("command file1.txt");
以上不起作用而command
找不到dir1/file1.txt
。如何使用Net::SSH2
更改工作目录?如何使用Net :: SSH2更改工作目录?
#$ chan-> exec('ls -la'); [从这里引用](http://www.perlmonks.org/?node_id=569657) – ssr1012
@ ssr1012这将列出目录。我不想这样做。 – CJ7
'$ chan-> exec(“./ command”);' –