Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Nov 2007 12:02:41 -0600
From:      Eric Crist <mnslinky@gmail.com>
To:        Bill Banks <office@ourweb.net>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: shell programming
Message-ID:  <7EA6F842-7C0D-4EFC-BF4D-DD83B0524597@gmail.com>
In-Reply-To: <47349D10.20709@ourweb.net>
References:  <47349D10.20709@ourweb.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

In short, with sh, simply use the built-in date command:

#!/bin/sh
weekday=`date "+%A"

See also man 3 strftime


-----
Eric F Crist
Secure Computing Networks





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7EA6F842-7C0D-4EFC-BF4D-DD83B0524597>