If there is time between each character, you can detect pauses.
Perl also performs line input - if you are not using getc, you should be able to add new lines to the end of foo, bar, etc., and perl will provide you with each line.
If you cannot add new lines, and you cannot depend on a pause, then what exactly do you expect from the system to tell perl that it launched a new command? As for perl, that is, a stdin pipe, it feeds on the data from it, and there is nothing in the stdin pipe to tell you when you are executing a new command.
Instead, you might consider the following:
$ echo "( echo -n foo ; sleep 5 ; echo -n bar ; sleep 5; echo baz)" | my_script.pl
or
$ my_script.pl$ "echo -n foo ; sleep 5 ; echo -n bar ; sleep 5; echo baz"
And modify your perl program to parse the input "command line" and complete each task, using standard output as needed.
-Adam
Adam davis
source share