Mailinglist Archive: opensuse (3280 mails)
| < Previous | Next > |
Re: [opensuse] Bash script problem regarding with some math
- From: Carl Hartung <suselinux@xxxxxxxxxxxxx>
- Date: Mon, 10 Dec 2007 22:55:39 -0500
- Message-id: <200712102255.39934.suselinux@xxxxxxxxxxxxx>
On Mon December 10 2007 09:34:34 pm Carlos E. R. wrote:
Hi Carlos,
A bit of Google research reveals the prefix '10#' tells bash to use base 10
(decimal) instead octal interpretation. What happens if you try this (or some
derivative?) :-)
DIFF=$[ (10#$LOC_H - 10#$HWC_H)*3600 + (10#$LOC_M - 10#$HWC_M)*60 +
(10#$LOC_S - 10#$HWC_S) ]
regards,
Carl
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
Obviously, it is thinking it is an octal number. How do I convince bash
to use standard base ten math? Is there a prefix?
Hi Carlos,
A bit of Google research reveals the prefix '10#' tells bash to use base 10
(decimal) instead octal interpretation. What happens if you try this (or some
derivative?) :-)
DIFF=$[ (10#$LOC_H - 10#$HWC_H)*3600 + (10#$LOC_M - 10#$HWC_M)*60 +
(10#$LOC_S - 10#$HWC_S) ]
regards,
Carl
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |