bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error in date command


From: Brian Dessent
Subject: Re: error in date command
Date: Mon, 01 May 2006 21:04:12 -0700

Adam Miller wrote:

>    According to the man page, /bin/date +%x should report the
> date in the following format: mm/dd/yy

No it doesn't, it says it reports the date in the format appropriate to
the current locale:

       %x     locale's date representation (e.g., 12/31/99)

Note that "e.g." means it's an example of one possible format.

>    However, when run in bash the command above reports the date in the
> following format: mm/dd/yyyy

Compare the output of:

LANG=C /bin/date +%x

to

LANG=en_US /bin/date +%x

>    I have been calling a bash script in through cron, which reports the
> date as it should.  So why would running the command in bash be different?

You most likely have something in your rc/profile scripts which only
runs for interactive login shells that sets the locale (LC_* and/or LANG
environment variables.)  When run from the cron job they are not set and
the default "C" locale is used.

Brian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]