
very useful in scripts. You can easily add or subtract days, hours
and/or minutes from a specified date. Supports all date(1) output
formats plus more.
download "yest" from
http://sourceforge.net/projects/yest/
get_age()
{
perl -e '@attrs1 = stat($ARGV[0]);
@attrs2 = stat($ARGV[1]);
printf "%d\n", $attrs2[9] - $attrs1[9];' $1 $2
}
age=`get_age ${1} ${2}`
echo age is $age seconds
===============================
$ touch test1; sleep 10; touch test2; ksh .//lt.sh test1 test2
age is 10 seconds

If your ls does not have the option, you will have to do it the hard way
0 comments:
Post a Comment