-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I have a bash script with this line: DIFF=$[ ($LOC_H - $HWC_H)*3600 + ($LOC_M - $HWC_M)*60 + ($LOC_S - $HWC_S) ] to calculate a time difference in seconds. Well, when the seconds are "08" it fails: cer@nimrodel:~> echo $[ (00 - 00)*3600 + (21 - 21)*60 + (08 -08) ] bash: (00 - 00)*3600 + (21 - 21)*60 + (08: value too great for base (error token is "08") Why? Notice that not all number combinations fail: cer@nimrodel:~> echo $[ (00 - 00)*3600 + (21 - 21)*60 + (01 -01) ] 0 cer@nimrodel:~> echo $[ (00 - 00)*3600 + (21 - 21)*60 + (01 -07) ] - -6 cer@nimrodel:~> echo $[ (01 - 01)*3600 + (21 - 21)*60 + (01 -08) ] bash: (00 - 00)*3600 + (21 - 21)*60 + (01 -08: value too great for base (error token is "08") Obviously, it is thinking it is an octal number. How do I convince bash to use standard base ten math? Is there a prefix? I get "08" out of cutting the seconds value from a time like "01:21:08"; removing the leading "0" is inconvenient, and absurd, IMO, and would take an inordinate length of coding. I could do something like: cer@nimrodel:~> echo $[ (100 - 100)*3600 + (121 - 121)*60 + (109 - 108) ] 1 which gives correct values, but again, it is an absurd hack. There must be some prefix for decimal numbers... :-? - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) iD8DBQFHXfc6tTMYHG2NR9URAnGdAJ9RyyFeuKKaUkON2RJkhyZ5N1B34QCfREku 1Feb2xJl5wLmTikOrm/dyOc= =R+io -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org