Hello,

     I have follow this exemple but the format date is invalide at bold line(down the page)

Is someone can tell me which format is the correct one?

Thanks

Canarich

 

  "Anthony E. Greene" <[EMAIL PROTECTED]> a écrit :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 13-Aug-2002/12:44 +0200, cana rich <[EMAIL PROTECTED]>wrote:
>I would like to make a diff in the date of a file from the copy to the
>dateday. I mean i would like to know how many days has been left since
>the copy of the file.
>
>Is it possible to have the number of days left? or hour ...?

You can check how long it has been since the last time the file was
modified.

The following script gets the current date and the modification date of
the file, both in the UNIX time (number of seconds since Jan 1, 1970),
then calculates the difference in hours and days.

#!/bin/sh
#
# Display the age of the file named on the command line.

# Get the current date in UNIX time.
currdateunix=`date +%s`

# Get the modification date of the file in human-readable format.!
filedate=`ls --full-time $1 | cut -c 48-62`

# Convert the human-readable file modification date to UNIX time.
filedateunix=`date -d "$filedate" +%s`

# Calculate the difference in seconds between the modification date and
# the current date.
fileageunix=$[$currdateunix-$filedateunix]

# Display the age in days and hours.
echo "$1 is $[$fileageunix/3600] hours or $[$fileageunix/86400] days old"

# End of script



Tony
- --
Anthony E. Greene
OpenPGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26 C484 A42A 60DD 6C94 239D
AOL/Yahoo Chat: TonyG05 HomePage:
Linux: the choice of a GNU Generation.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Anthony E. Greene 0x6C94239D <[EMAIL PROTECTED]>

iD8DBQE9WPtopCpg3WyUI50RAgyHAJsFyuME0nesHqys+kapmFp40WdlCQCeN/Uy
TSiDrMinBvyVIWQVB! KGAyAg=
=bHQM
-----END PGP SIGNATURE-----


--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list



Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !

Reply via email to