use strict; use warnings; use Net::SSH::Expect; my $ssh = Net::SSH::Expect->new( host => '10.0.0.9', user => 'bw', password => 'test12', raw_pty => 1 ); my $login_output = $ssh->login("login:","password:",1); my $c = $ssh->exec("touch test"); print "----->".$c."<---"; print "\n"; if ($c eq '[bw@localhost ~]$ ' ){ print "1 gefunden\n"; } if($c =~ /^\[(.)*\@(.)*\ \~\]\$ $/){ print "2 gefunden!\n"; }else { print "2 nicht gefunden!\n"; } $c = '[bw@localhost ~]$ '; if($c =~ /^\[(.)*\@(.)*\ \~\]\$ $/){ print "3 gefunden!\n"; }else { print "3 nicht gefunden!\n"; }