Re: Can't stop script with ctrl-c
Stephane CHAZELAS <this.address@is.invalid> wrote:
>Yes, bash has a funny way of handling sigint. bash will only
>exit upon receiving a SIGINT if the current command was killed
>by that sigint as well (apparently).
>
>So, if "festival" ignores the sigints, it will not exit.
Festival doesn't seem to ignore the ctrl-c - it will cancel the word
that it's saying and the script goes on to start the next one.
>You can try:
>
>#! /bin/bash -
>while :; do
> echo "hello" | festival --tts &
> wait
>done
>
>Then, the CTRL-C will interrup the "wait" instead of festival
>(which will continue running).
Thanks. That works.
>
>Or:
>
>#! /bin/bash -
>trap 'exit 1' INT
>while :; do
> echo "hello" | festival --tts
>done
>
>This way, bash will still block the SIGINT but will execute its
>handler (exit 1) when festival finishes.
That works too.
--
Dave Farrance
|