shell programming

Eric Crist mnslinky at
Fri Nov 9 10:02:58 PST 2007

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:

weekday=`date "+%A"

See also man 3 strftime

Eric F Crist
Secure Computing Networks

More information about the freebsd-questions mailing list