jonathan+freebsd-questions at hst.org.za
Fri Nov 9 21:44:06 PST 2007
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.
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'
More information about the freebsd-questions