Shell Script Question

I am trying to write my first real script, and I have a problem. I simply want to record 1 second of audio to a file, and do so on an automated basis. My script is:

rec sample.au & sleep 1s kill -INT $!

The problem is that the process "sox" still runs after my script executes and the output file is corrupt. Any help on this would be appreciated.

Reply to
David Lightman
Loading thread data ...

Are you sure SIGINT is handled correctly by 'rec' ? Can you kill it by issuing the command at the command line? Look if it is a matter of the 'rec' or may be a wrong PID in $!

Heinz

Reply to
Heinz-Jürgen Oertel

rec sample.au (manually wait 1 sec)

That works like I want, and I am just trying to script that.

$! seems to be the correct PID.

I thought SIGINT was supposed to be the same as . I think, based on what I am seing here, it may not be......

Reply to
David Lightman

Yes SIGINT is the Signal what should be received entering ^C from stdin. What happens if you try

rec sample.au < /dev/null > /dev/null

and may be directing stderr as well to /dev/null. The exact syntax depends on the used shell. You never talked about the system and tools you are using.

Heinz

Reply to
Heinz-Jürgen Oertel

change your kill line to

kill -INT 0

this will deliver int to all processes in the process group (your script).

Reply to
Ari Rankum

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.