[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash scripting question



Mike McClain wrote:
I've written a function to print elapsed time similar to /usr/bin/time
but can be called at the beginning and end of a script from within
the script. Occasionally I get an error: '8-08: value too great for base'
It's caused by the difference in these 2 command strings but I can't for the life of me see what's going on.

now='09:07:16'; startHr=${now%%:*}; startHR=${startHr#*0}; echo $startHr; 09

str=09; str=${str#*0}; echo $str;


I do it like this
# Set date format
ISO_8601='%Y-%m-%d %H:%M:%S%z'


aptitude safe-upgrade
date "+System Upgrade Completed at: $ISO_8601">>/root/Admin/last-upgrade

the result is

Update started at          : 2010-03-19 08:50:53-0400
Update completed at        : 2010-03-19 08:52:19-0400
Upgrade Download started at : 2010-03-19 08:52:19-0400
Download Completed at      : 2010-03-19 09:01:52-0400
System Upgrade Completed at: 2010-03-19 09:05:39-0400

HTH

Wayne


Reply to: