littlehere@gmail.com wrote:
> Cyrus Kriticos wrote:
>> [bash]
>>
>> $ FILENAME="foobar1_090207"
>> $ TIME="${FILENAME#*_}"
>>
>> $ PAST="$(date -d "20${TIME:4:2}-${TIME:0:2}-${TIME:2:2}" +'%s')"
>> $ NOW=$(date -d $(date +'%Y-%m-%d') +'%s')
>>
>> $ let DIFF=(NOW-PAST)/60/60/24
>> $ echo "diff in days: $DIFF"
>> diff in days: 9
>>
>> --
>> Best regards | "The only way to really learn scripting is to write
>> Cyrus | scripts." -- Advanced Bash-Scripting Guide
>
> Quick question- are you using Solaris? I don;t have the '-d' flag for
> the format.
Linux, sorry.
--
Best regards | "The only way to really learn scripting is to write
Cyrus | scripts." -- Advanced Bash-Scripting Guide