I've narrowed it down to passwd
my $exp = Expect->new("passwd fred") or die "Cannot spawn: $!\n"; $Expect::Exp_Internal = 1; my $timeout = 5; $exp->expect($timeout, [ qr/UNIX password:/ => sub { my $exp = shift; $exp->send("sponge\n"); exp_continue; } ], ); $exp->soft_close();
Get either timeout, but add a ; to the end of the command and it works fine.
Update: that's not true, it sometimes fails--
Steve Marvell
In reply to Re: expect and adduser
by marvell
in thread expect and adduser
by marvell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |