Unix Shell - confused by date

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > January 2007 > confused by date





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author confused by date
mark_doherty@yahoo.co.uk

2007-01-23, 1:26 am

We are having problems with 'date' on our CX/UX version 7.1
Basically files created by 'cp' are 1 year old, whereas 'touch' creates
the file with the correct date.

Notice below that a has todays date, but b and sh.log are 1 year old!

Any ideas

#! /bin/ksh
rm a b
date > sh.log
touch a
cp a b
ls -l >> sh.log
date >> sh.log

more sh.log

Tue Jan 23 02:10:36 GMT 2007
total 4
-rw-rw-r-- 1 flt d61flt 0 Jan 23 02:10 a
-rwxrwxrwx 1 flt d61flt 72 Jan 23 2006 a.sh
-rw-rw-r-- 1 flt d61flt 0 Jan 23 2006 b
-rw-rw-r-- 1 flt d61flt 29 Jan 23 2006 sh.log
Tue Jan 23 02:10:36 GMT 2007

Barry Margolin

2007-01-24, 7:47 am

In article <1169519225.380744.274580@a75g2000cwd.googlegroups.com>,
mark_doherty@yahoo.co.uk wrote:

> We are having problems with 'date' on our CX/UX version 7.1
> Basically files created by 'cp' are 1 year old, whereas 'touch' creates
> the file with the correct date.
>
> Notice below that a has todays date, but b and sh.log are 1 year old!


Are you using a fileserver? It looks to me like the date on the server
is wrong. When you use "touch", it forcibly sets the modification time
to the current time on the client. When you write to a file, the server
sets the modification time using its clock.

>
> Any ideas
>
> #! /bin/ksh
> rm a b
> date > sh.log
> touch a
> cp a b
> ls -l >> sh.log
> date >> sh.log
>
> more sh.log
>
> Tue Jan 23 02:10:36 GMT 2007
> total 4
> -rw-rw-r-- 1 flt d61flt 0 Jan 23 02:10 a
> -rwxrwxrwx 1 flt d61flt 72 Jan 23 2006 a.sh
> -rw-rw-r-- 1 flt d61flt 0 Jan 23 2006 b
> -rw-rw-r-- 1 flt d61flt 29 Jan 23 2006 sh.log
> Tue Jan 23 02:10:36 GMT 2007


--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com