I have a Perl script which performs some tasks, one of which is to call a system
command to "tar -cvf file.tar....."
.
This can often take some time so I'd like the command line to echo back a progress indicator, something like a #
echoing back to screen whilst the system
call is in progress.
I've been doing some digging around and stumbled across fork
. Is this the best way to go? Is it possible to fork off the system
command, then create a while loop which checks on the staus of the $pid
returned by the fork?
I've also seen references to waitpid
.... I'm guessing I need to use this also.
fork system("tar ... ")
while ( forked process is still active) {
print #
sleep 1
}
Am I barking up the wrong tree?
Many thanks John