[clug] incrementing time

Nemo -earth native- nemo at nut.house.cx
Wed Nov 5 10:32:16 EST 2003


On Wed, Nov 05, 2003 at 09:48:24AM +1100, Rousak, Boris did utter:

> This is a bit basic but I am having a mind blank :). I am trying to write a
> script that will check a time stamp written in a file to see if it has been
> an hour since it was made. The stamp is in a format, Nov 03 07:32:06. I am

Just occured to me - how important is it that you check since hte time
the file was /made/, compared to last modified?

`date` will give you seconds since epoch for hte modification time of a
file simply with:

date -r /path/to/file +%s

Comparing the result of that with date +%s then becomes very trivial. 

If the creation time is the important time, rather than modification,
then parsing the output of `ls` looks to be the solution. 
(something like (insert your own --time= option in as necessary):
date -d "`ls -o base3| awk -F' ' '{print $5" "$6" "$7}'`" +%s

Hope this helps 

.../Nemo
-- 
  ------------------------------------------ --------------------------
                                                    earth native



More information about the linux mailing list