shell script bug [was: capturing CBC Radio from an internet stream]
Eric Battersby
gyre-Ja3L+HSX0kI at public.gmane.org
Tue Apr 8 10:21:46 UTC 2008
On Mon, 7 Apr 2008, D. Hugh Redelmeier wrote:
> | Date: Sun, 17 Feb 2008 02:09:21 -0500 (EST)
> | From: D. Hugh Redelmeier <hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org>
>
> | Here's a shell script that I call GRAB1hrCBC1mms:
>
> | DATE=`date +%Y.%m.%d-%H.%M`
> |
> | mmsrip --delay=3600 --output=$DATE.wma mms://wm.cbc.ca/cbcr1-${CITY:-toronto}
>
> I "improved" this, allowing the recording time to be overridden and a
> description to be added to the resulting file's name:
> mmsrip --delay=${SECONDS:-3600} --output=${DATE}${DESCRIPTION:-}.wma \
> mms://wm.cbc.ca/cbcr1-${CITY:-toronto}
>
> Simple and useful, eh?
>
> Well, the result was that my partition slowly filled up and the
> recording never terminated. The first time, I thought it was a fluke.
Also, I had 'mmsrip' (version 0.6.5) hang, so I called it via
"timeout" as a double precaution, where the timeout value is
a minute longer.
> It turns out that bash "owns" the variable SECONDS. It is the number
> of seconds since the shell was invoked. mmsrip was probably seeing
> --delay=0.
>
> I hate reserved words. I hate silently reserved words -- no warning
> just bad behaviour.
>
> The fix is simple. I used DURATION instead.
Is it possible that a future BASH could use 'DURATION' as a
reserverd word?
--
Eric Battersby.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list