Prev: (Partially SOLVED) Re: Wireless still not working
Next: How to reduce a debian system to a base system
From: Mike McClain on 19 Mar 2010 13:40 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; 9 Thanks, Mike -- Satisfied user of Linux since 1997. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/20100319171928.GB31777(a)playground.mcclains.net
From: Sven Joachim on 19 Mar 2010 13:50 On 2010-03-19 18:19 +0100, 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. Apparently bash is treating the number as octal because it starts with a leading 0. Sven -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/87bpekp5n8.fsf(a)turtle.gmx.de
From: Chris Jackson on 19 Mar 2010 14:00 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; > 9 Did you mean to echo $startHR - capital 'R' - in the first one? That is '9' as you are expecting ;) -- Chris Jackson Shadowcat Systems Ltd. -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/4BA3BB55.50907(a)shadowcat.co.uk
From: S Scharf on 19 Mar 2010 14:00 On Fri, Mar 19, 2010 at 1:19 PM, Mike McClain <mike.junk(a)nethere.com> 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; > 9 > > Thanks, > Mike > > Did you wand to echo startHR and not startHr in the first expression? Stuart
From: Wayne on 19 Mar 2010 14:10 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 -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/4BA3BD88.4020007(a)gmail.com
|
Next
|
Last
Pages: 1 2 3 Prev: (Partially SOLVED) Re: Wireless still not working Next: How to reduce a debian system to a base system |