http://qs321.pair.com?node_id=1121610


in reply to perl parallel script

After you run the script, run the following:

echo $?

Based on the change_password() subroutine, I expect you will get the value 1 back indicating there is an error and something doesn't match.

sub change_password { my ($host, $ssh) = @_; my ($pty) = $ssh->open2pty('passwd'); my $expect = Expect->init($pty); $expect->raw_pty(1); # $expect->log_user(1); if (answer_passwd($expect, 'current.*:', $old) and answer_passwd($expect, 'Enter new.*:', $new) and answer_passwd($expect, 'Retype new.*:', $new) and $expect->expect($timeout, "success")) { exit(0); } exit(1); }

Also, I'm wondering if this script will ever work as is, since it seems like it will always exit before it completes its 'mission'. Perhaps you could change that subroutine to by deleting the exit() statements or changing exit(0); to return;.