1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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";
}
$c =~ /^\[(.)*\@(.)*\ \~\]\$ $
$c =~ /^\[(.*)\@(.*) ~\]\$ $
1
2
3
4
5
6
print Dumper($c);
if($c =~ /^\[(.*)\@(.*)\s\~\]\$\s$/){
print " gefunden!\n";
}else {
print " nicht gefunden!\n";
}