On Mon, Mar 02, 2009 at 10:55:29PM +0800, lacalling wrote: > Since mpg123 does not support repeat model, i tried to write a script to > play mp3 repeatedly. > > I tried bash like this > for((;;)) > do > mpg123 [mp3] & > done > but it keeps running new mpg123 in background .
You asked for it to run in the background (with '&'). In fact, you're spawning many mpg123 processes here... > but mpg123 [mp3] in foreground cant be terminated by control C Not too familiar with mpg123 (I'm using mplayer), but in such close loops, Ctrl-C usually works, but not as intended: it stops one mpg123 process (unless mpg123 sets its signal mask in such a way as to block or ignore SIGINT?), but the next one resumes almost immediately thereafter. To Ctrl-C the loop itself is not easy, because the time slice between the end of one mpg123 process and the start of the next one (when the shell is in the foreground) is pretty tiny. Try adding a 'sleep 1' or something like that after mpg123, and it will be easier. > Could anyone provide more ideas. > thank you. -cpghost. -- Cordula's Web. http://www.cordula.ws/ _______________________________________________ email@example.com mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"