H
Hal Vaughan
There may be a better way to do what I want to do, so I'm open to
suggestions.
I want to run a shell command to record sound, and kill it after x seconds.
If I were writing a Bash script, I'd run the command in the background, get
the PID, use a sleep statement, then kill the first command after the sleep
statement. In Perl I know how to fork and get a PID, and I know how to use
`command` to get a commands output, but I can't find a way to run a command
from Perl and get the PID so I can kill it when I want.
Is there a way to get the PID? (I'd rather not use a 2nd script in bash to
do it.)
If there's another way to execute a shell command from Perl, then after x
seconds kill it, I'm open to it.
Thanks!
Hal
suggestions.
I want to run a shell command to record sound, and kill it after x seconds.
If I were writing a Bash script, I'd run the command in the background, get
the PID, use a sleep statement, then kill the first command after the sleep
statement. In Perl I know how to fork and get a PID, and I know how to use
`command` to get a commands output, but I can't find a way to run a command
from Perl and get the PID so I can kill it when I want.
Is there a way to get the PID? (I'd rather not use a 2nd script in bash to
do it.)
If there's another way to execute a shell command from Perl, then after x
seconds kill it, I'm open to it.
Thanks!
Hal