in reply to Re: expect.pm how to ignore special characters
in thread expect.pm header
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();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: expect.pm how to ignore special characters
by amagana (Acolyte) on Apr 15, 2015 at 18:54 UTC | |
|
Re^3: expect.pm how to ignore special characters
by sn1987a (Curate) on Apr 15, 2015 at 19:42 UTC |