#!/usr/bin/perl use Net::OpenSSH; my $host = "10.100.110.51"; my $user = "admin"; my $pass = "my_pw"; #$Net::OpenSSH::debug=-1; my $ssh = Net::OpenSSH->new(host=>$host, user=>$user, password=>$pass, master_opts => [-v, -o => "StrictHostKeyChecking=no"], ); $ssh->error and die "Couldn't establish SSH connection: ". $ssh->error; my $xxx = "source /opt/CPshrd-R77/tmp/.CPprofile.sh ; /opt/CPsuite-R77/fw1/bin/dbedit --h"; #my (@ls,$errput) = $ssh->capture2({tty => 1},"/opt/CPsuite-R77/fw1/bin/dbedit --h"); my (@ls,$errput) = $ssh->capture2({tty => 1},$xxx); $ssh->error and die "remote ls command failed: " . $ssh->error; print"LS:@ls\n"; print"ERR:$errput\n";