Thanks a lot for your comments . It is my first bash script, so I have a lot
to learn. I will integrate thoses changes !

2009/2/21 Charles-Henri Gros
<charles-henri.gros+openm...@m4x.org<charles-henri.gros%2bopenm...@m4x.org>
>

> kimaidou wrote:
> > I am answering myself here : I found the solution :you have to add a "&"
> > at the end of the arecord line
> > So the file content is now :
> >
> > #!/bin/bash
> > zenity --question --title="Voice-note" --text="Click Validate to START
> > recording"; gostart=$?
> >
> > if [ "$gostart" = 1 ]
> >     then
> >         echo "Operation canceled"
> >         exit
> >     else
> >         echo "Recording..."
> > fi
> > arecord -D hw -f cd  -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &
> > alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore &
>
> This line should not end with '&' and should probably come before the
> "arecord" line
>
> > zenity --info --title="Voice-note" --text="Click Validate to STOP
> > recording"; gostop=$?
> >
> > killall -TERM arecord
>
> You should use "kill %1" instead, this will only kill the instance you
> just started (and TERM is the default). For that, you need to enable job
> control (set -m)
>
> > alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore
> > zenity --info --title="Voice note" --text="Your voice-note has been
> > recorded"; goread=$?
> >
> > #END OF FILE
>
> Result:
>
> #!/bin/bash
> # Exit on error
> # Enable job control
> set -em
> zenity --question --title="Voice-note" --text="Click Validate to START
> recording"; gostart=$?
>
> if [ "$gostart" = 1 ]
>    then
>        echo "Operation canceled"
>        exit 1
>    else
>        echo "Recording..."
> fi
> alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore
> arecord -D hw -f cd  -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &
> zenity --info --title="Voice-note" --text="Click Validate to STOP
> recording"
>
> # Kill arecord
> kill %1
> alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore
> zenity --info --title="Voice note" --text="Your voice-note has been
> recorded"
>
> #END OF FILE
>
>
> --
> Charles-Henri
>
>
> _______________________________________________
> Openmoko community mailing list
> community@lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community
>
_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community

Reply via email to