From owner-freebsd-questions@FreeBSD.ORG Sat Nov 10 05:44:06 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F99216A419 for ; Sat, 10 Nov 2007 05:44:06 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from hermes.hst.org.za (onix.hst.org.za [209.203.2.133]) by mx1.freebsd.org (Postfix) with ESMTP id C9D0313C4A5 for ; Sat, 10 Nov 2007 05:44:05 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from [10.1.11.1] ([10.1.11.1]) (authenticated bits=0) by hermes.hst.org.za (8.13.8/8.13.8) with ESMTP id lAA5g49U025395 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 10 Nov 2007 07:42:04 +0200 (SAST) (envelope-from jonathan+freebsd-questions@hst.org.za) From: Jonathan McKeown To: freebsd-questions@freebsd.org Date: Sat, 10 Nov 2007 07:45:43 +0200 User-Agent: KMail/1.9.4 References: <47349D10.20709@ourweb.net> <7EA6F842-7C0D-4EFC-BF4D-DD83B0524597@gmail.com> In-Reply-To: <7EA6F842-7C0D-4EFC-BF4D-DD83B0524597@gmail.com> Organization: Health Systems Trust X-Face: $@VrUx^RHy/}yu]jKf/<4T%/d|F+$j-Ol2"2J$q+%OK1]&/G_S9(=?iso-8859-1?q?HkaQ*=60!=3FYOK=3FY!=27M=60C=0A=09aP=5C9nVPF8Q=7DCilHH8l?= =?iso-8859-1?q?=3B=7E!42HK6=273lg4J=7Daz?=@1Dqqh:J]M^"YPn*2IWrZON$1+G?oX3@ =?iso-8859-1?q?k=230=0A=0954XDRg=3DYn=5FF-etwot4U=24b?=dTS{i X-Spam-Score: -4.293 () ALL_TRUSTED,AWL,BAYES_00 X-Scanned-By: MIMEDefang 2.61 on 209.203.2.133 Subject: Re: shell programming X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2007 05:44:06 -0000 On Friday 09 November 2007 20:02, Eric Crist wrote: > On Nov 9, 2007, at 11:46 AM, Bill Banks wrote: > > I'm writing a backup script. I need to get the day of the week into > > a variable. How can I do it? > > Well, it depends on what you're using. If you're using sh, see `man > date`. If you're using perl, it's quite complicated. Not really: use POSIX 'strftime'; my $day_of_week = strftime '%A', localtime; POSIX has always been a core module. To see this in action from a commandline, perl -MPOSIX=strftime -le 'print strftime q/%A/, localtime' Jonathan