in reply to How to monitor/look for output?

Assuming that you cannot / are not allowed to modify the original scripts, why don't you just run the first script in backticks and collect it's output? Then, based on the output you can either run the second script or do something else.

Replies are listed 'Best First'.
Re^2: How to monitor/look for output?
by scottdware (Sexton) on Jun 03, 2009 at 08:31 UTC
    Yeah, that's how I have it setup currently. For that though, should I use a "foreach" loop to cycle through the lines of the output and look for certain output, or what do you think would be the best way to go about that?
      The correct solution depends strongly on what the script is outputting. I would note that backticks return a scalar, so a foreach would be kinda pointless without splitting or some such. Likely the best choice is to think about what is different about successful vs. failing executions and craft a regular expression to check the output string whole hog. We could help with that if you gave us sample outputs for success and failures.

        Basically, the output that I would be looking for that returns from the other commands is:

        XX files copied (where XX is a number)

        Restored successfully

        If I run the commands in backticks, and have that placed in an array, like @output = `command`, would it then be best to do a foreach loop to look for that output?