From owner-freebsd-questions Mon Dec 24 10:29: 9 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mcqueen.wolfsburg.de (pns.wobline.de [212.68.68.5]) by hub.freebsd.org (Postfix) with ESMTP id 7EF4637B417 for ; Mon, 24 Dec 2001 10:29:06 -0800 (PST) Received: from colt.ncptiddische.net (ppp-215.wobline.de [212.68.69.226]) by mcqueen.wolfsburg.de (8.11.3/8.11.3/tw-20010821) with ESMTP id fBOIT4826693 for ; Mon, 24 Dec 2001 19:29:04 +0100 Received: from tisys.org (jodie.ncptiddische.net [192.168.0.2]) by colt.ncptiddische.net (8.11.6/8.11.6) with ESMTP id fBOIV7X61184 for ; Mon, 24 Dec 2001 19:31:07 +0100 (CET) (envelope-from nils@tisys.org) Received: (from nils@localhost) by tisys.org (8.11.6/8.11.6) id fBOITsc89337 for freebsd-questions@freebsd.org; Mon, 24 Dec 2001 19:29:54 +0100 (CET) (envelope-from nils) Date: Mon, 24 Dec 2001 19:29:19 +0100 From: Nils Holland To: freebsd-questions@freebsd.org Subject: Questions to all script wizards out there... Message-ID: <20011224192919.A89314@tisys.org> Mail-Followup-To: freebsd-questions@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-Operating-System: FreeBSD jodie.ncptiddische.net 4.5-PRERELEASE FreeBSD 4.5-PRERELEASE X-Machine-Uptime: 7:19PM up 9:53, 2 users, load averages: 0.00, 0.00, 0.00 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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///.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///.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 by one. However, not each month has the same number of days, so assuming that after 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