On Friday 17 March 2006 00:21, Cor van Haastregt wrote:
On Thu, Mar 16, 2006 at 11:39:40PM +0100, Anders Johansson wrote:
ls -l |grep drwx | cut -d':' -f2|cut -d' ' -f2 > skripts/tmp_test
By the way, what is your locale? In the default locale (C or POSIX) not all directory time stamps will have a : in them. The older ones will have a year where newer ones have a clock time
I don't know what you mean with this, how can i see the settings of my locale?
The simplest would be to just open a shell and type locale
I am using SuSE 9.3, all updates installed.
I notice the locale nl_NL doesn't do this
cron uses the C locale by default
Can you help me explaining this, an url would be sufficient.
The locale defines all the localisation aspects of your system, which language your error messages will be in, which sort order your system uses, which way your dates are printed etc. etc. etc. Normally your locale is defined by the language you select when you install the system, so if you select English(US) you will get en_US as you did. The C (or POSIX) locale is defined by the posix standard and must be present on any posix compliant system, such as linux. Your command uses the fact that when you do ls -l, the clock in the time stamp will be the first is the on the line that contains a :, but the problem is that in the C locale, the dates aren't printed in the same way as in the en_US locale. If you open a shell and type LANG=C ls -l you'll see what I mean. The older directories (which will probably be the ones which were missing in your file after cron ran the script) will say something like Jan 5 2004 and the other ones will say something like Mar 3 20:03 because the C locale will switch to printing the year once the file/directory becomes old enough. This was what broke your script. cron doesn't use the system locale, so if you rely on it in a script run by cron, you need to set it explicitly
The strange thing is, it worked fine untill a month or 3 ago.
Could it perhaps be that up until that time, the directories weren't old enough? -- Certified: Yes. Certifiable: of course! jabber ID: anders@rydsbo.net