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

Using yes may help:
($out,$err) = $ssh->capture2("yes|cfgsave");

Replies are listed 'Best First'.
Re^2: issue with passing yes to the output of a command
by janasec (Sexton) on Jul 26, 2015 at 15:46 UTC

    tried above step

    ($out,$err) = $ssh->capture2("yes|cfgsave");

    getting error

    2015/07/27 02:38:56 saving the zone remote find command failed:child exited with code 248 at ./switchconfi +g.pl line 113, <$fh> line 4.
      It seems that 'cfgsave' passed the yes/no question, and looks like another issue. How does 'cfgsave' behave if you run manually?

        thanks guys i think adding "\" made the difference

        ($out,$err) = $ssh->capture2("zonecreate \"test1\", \"20:00:00:11:0d:3 +4:56:00\""); ($out,$err) = $ssh->capture2("echo yes\|cfgsave");

        thanks friends again for help

        DS_6505B:admin> cfgsave You are about to save the Defined zoning configuration. This action will only save the changes on Defined configuration. If the update includes changes to one or more traffic isolation zones, you must issue the 'cfgenable' command for the changes to take effect. Do you want to save the Defined zoning configuration only? (yes, y, n +o, n): [no] y Nothing changed: nothing to save, returning ...

        i need to pass yes after cfgsave