hungryhungryhippo
Programmer
Hi everyone,
I'm trying to get the output of a command - preferably line by line - before it has returned.
Say you have some command outputting stuff over a length of time. like this:
Now you have a program that invokes such a command and you don't want it to wait for the command to finish but to get every line the command produces as soon as it would be written to the terminal. how do i do that?
it doesn't have to be non-blocking, i just need every line of output immediately. I'm using perl 5.8.8 on Debian Etch. Thanks and best Regards,
Michael
I'm trying to get the output of a command - preferably line by line - before it has returned.
Say you have some command outputting stuff over a length of time. like this:
Code:
#!/usr/bin/perl
foreach (1..10) {
print 'This is cycle '.$_."\n";
sleep(1);
}
Now you have a program that invokes such a command and you don't want it to wait for the command to finish but to get every line the command produces as soon as it would be written to the terminal. how do i do that?
it doesn't have to be non-blocking, i just need every line of output immediately. I'm using perl 5.8.8 on Debian Etch. Thanks and best Regards,
Michael