in reply to issue with passing yes to the output of a command

You can pass the 'yes' using NET::OpenSSH's 'stdin_data' option:

($out,$err) = $ssh->capture2({stdin_data => 'yes'}, "cfgsave");

If cfgsave needs more input after the 'yes', pass it as an array ref:

my $answers = ['yes', 'no', 'wait', 'sorry']; ($out,$err) = $ssh->capture2({stdin_data => $answers}, "cfgsave");

Replies are listed 'Best First'.
Re^2: issue with passing yes to the output of a command
by salva (Canon) on Jul 27, 2015 at 13:51 UTC
    Sometimes a "\n" is also needed.