Thanks a lot for your comments . It is my first bash script, so I have a lot to learn. I will integrate thoses changes !<br><br><div class="gmail_quote">2009/2/21 Charles-Henri Gros <span dir="ltr"><<a href="mailto:charles-henri.gros%2Bopenmoko@m4x.org">charles-henri.gros+openmoko@m4x.org</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">kimaidou wrote:<br>
> I am answering myself here : I found the solution :you have to add a "&"<br>
> at the end of the arecord line<br>
> So the file content is now :<br>
><br>
> #!/bin/bash<br>
> zenity --question --title="Voice-note" --text="Click Validate to START<br>
> recording"; gostart=$?<br>
><br>
> if [ "$gostart" = 1 ]<br>
> then<br>
> echo "Operation canceled"<br>
> exit<br>
> else<br>
> echo "Recording..."<br>
> fi<br>
> arecord -D hw -f cd -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &<br>
> alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore &<br>
<br>
This line should not end with '&' and should probably come before the<br>
"arecord" line<br>
<br>
> zenity --info --title="Voice-note" --text="Click Validate to STOP<br>
> recording"; gostop=$?<br>
><br>
> killall -TERM arecord<br>
<br>
You should use "kill %1" instead, this will only kill the instance you<br>
just started (and TERM is the default). For that, you need to enable job<br>
control (set -m)<br>
<br>
> alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore<br>
> zenity --info --title="Voice note" --text="Your voice-note has been<br>
> recorded"; goread=$?<br>
><br>
> #END OF FILE<br>
<br>
Result:<br>
<br>
#!/bin/bash<br>
# Exit on error<br>
# Enable job control<br>
set -em<br>
zenity --question --title="Voice-note" --text="Click Validate to START<br>
recording"; gostart=$?<br>
<br>
if [ "$gostart" = 1 ]<br>
then<br>
echo "Operation canceled"<br>
exit 1<br>
else<br>
echo "Recording..."<br>
fi<br>
alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore<br>
arecord -D hw -f cd -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &<br>
zenity --info --title="Voice-note" --text="Click Validate to STOP recording"<br>
<br>
# Kill arecord<br>
kill %1<br>
alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore<br>
zenity --info --title="Voice note" --text="Your voice-note has been<br>
recorded"<br>
<br>
#END OF FILE<br>
<font color="#888888"><br>
<br>
--<br>
Charles-Henri<br>
<br>
<br>
_______________________________________________<br>
Openmoko community mailing list<br>
<a href="mailto:community@lists.openmoko.org">community@lists.openmoko.org</a><br>
<a href="http://lists.openmoko.org/mailman/listinfo/community" target="_blank">http://lists.openmoko.org/mailman/listinfo/community</a><br>
</font></blockquote></div><br>