Thank you sn1987a
It looks like that worked for the root password but I used the same single quotes for when I get my password changed. The script stops now at when I do a expect/send after sending passwd amagana at New UNIX Password like this..
[root@Remotehost ~]# Starting EXPECT pattern matching... at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 561 Expect::expect('Expect=GLOB(0xc4cc170)', 60, 'New UNIX Passwor +d:') called at test-a-filehandle.pl line 82 main::change_password('linux-host\x{a}') called at test-a-file +handle.pl line 39 passwd amagana Changing password for user amagana. New UNIX password:
$ssh->send("passwd amagana\n"); $ssh->expect(60, 'New UNIX Password:'); #linux $ssh->send( 'XxX*%xx,^xxxxXx_' . "\n"); $ssh->expect(60, 'Retype new UNIX password:'); #linux $ssh->send( 'XxX*%xx,^xxxxXx_' . "\n"); $ssh->expect(60, '#'); $ssh->send("exit\n"); $ssh->expect(60, '$'); $ssh->send("exit\n"); $ssh->close();
In reply to Re^2: expect.pm how to ignore special characters
by amagana
in thread expect.pm header
by amagana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |