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">&lt;<a href="mailto:charles-henri.gros%2Bopenmoko@m4x.org">charles-henri.gros+openmoko@m4x.org</a>&gt;</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>
&gt; I am answering myself here : I found the solution :you have to add a &quot;&amp;&quot;<br>
&gt; at the end of the arecord line<br>
&gt; So the file content is now :<br>
&gt;<br>
&gt; #!/bin/bash<br>
&gt; zenity --question --title=&quot;Voice-note&quot; --text=&quot;Click Validate to START<br>
&gt; recording&quot;; gostart=$?<br>
&gt;<br>
&gt; if [ &quot;$gostart&quot; = 1 ]<br>
&gt; &nbsp; &nbsp; then<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;Operation canceled&quot;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; exit<br>
&gt; &nbsp; &nbsp; else<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;Recording...&quot;<br>
&gt; fi<br>
&gt; arecord -D hw -f cd &nbsp;-v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &amp;<br>
&gt; alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore &amp;<br>
<br>
This line should not end with &#39;&amp;&#39; and should probably come before the<br>
&quot;arecord&quot; line<br>
<br>
&gt; zenity --info --title=&quot;Voice-note&quot; --text=&quot;Click Validate to STOP<br>
&gt; recording&quot;; gostop=$?<br>
&gt;<br>
&gt; killall -TERM arecord<br>
<br>
You should use &quot;kill %1&quot; 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>
&gt; alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore<br>
&gt; zenity --info --title=&quot;Voice note&quot; --text=&quot;Your voice-note has been<br>
&gt; recorded&quot;; goread=$?<br>
&gt;<br>
&gt; #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=&quot;Voice-note&quot; --text=&quot;Click Validate to START<br>
recording&quot;; gostart=$?<br>
<br>
if [ &quot;$gostart&quot; = 1 ]<br>
 &nbsp; &nbsp;then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;Operation canceled&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;exit 1<br>
 &nbsp; &nbsp;else<br>
 &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;Recording...&quot;<br>
fi<br>
alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore<br>
arecord -D hw -f cd &nbsp;-v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &amp;<br>
zenity --info --title=&quot;Voice-note&quot; --text=&quot;Click Validate to STOP recording&quot;<br>
<br>
# Kill arecord<br>
kill %1<br>
alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore<br>
zenity --info --title=&quot;Voice note&quot; --text=&quot;Your voice-note has been<br>
recorded&quot;<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>