Date: Mon, 24 Dec 2001 19:29:19 +0100 From: Nils Holland <nils@tisys.org> To: freebsd-questions@freebsd.org Subject: Questions to all script wizards out there... Message-ID: <20011224192919.A89314@tisys.org>
next in thread | raw e-mail | index | archive | help
Hi folks, there are many things that I'd like to eventually learn, for example writing advanced shell scripts. Right now, I'd like to set up a script for a particular purpose, but I don't really know how to go about it. Here's what this script should do: I would like the script to use wget in order to fetch the program listing of a radio station from the station's website. I would like to have seven days fetched in advance. Now, the URL always looks like this: http://www.dradio.de/dlf/vorschau/<year>/<month>/<day>.html So in order to make wget fetch today's program, I'd run it like this: wget -options http://www.dradio.de/dlf/vorschau/2001/12/24.html That's the theory, but how do I tell my shell script to do that? I have two problems, one of which is probably easy to solve, while the other is a little tough: 1) The shell script would have to have a look at today's date and construct the appropriate URL. It would probably have to obtain the output of date and assign the year, month and day values to some variables, and then create the http://www.dradio.de/dlf/vorschau/<year>/<month>/<day>.html URL. Now, any ideas how to get that done in a script? 2) As I said, I'd like to get seven days fetched in advance. An easy way to do that would be to simply loop multiple times, always incrementing <day> by one. However, not each month has the same number of days, so assuming that after <day> has reached 31 it should start from 1 again is not always accurate. I guess handling this in a shell script would be a fairly hard thing to do, but if someone has any ideas if it's (easily) possible, I'd like to know it. Greetings Nils -- Nils Holland Ti Systems - FreeBSD in Tiddische, Germany http://www.tisys.org * nils@tisys.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011224192919.A89314>