Scully, William P wrote:
I've reported this to the vendor but I found this error a bit
astonishing:

# ksh -vx poo.ksh
date=0605
+ date=0605
((mm=${date}/100))
+ ((mm=0605/100))
echo ${mm}
+ echo 3
3
exit 0
+ exit 0

I get this result on SLES 10.

I just spotted this because someone's hijacked the thread, talking about
something irrelevant to it.

I generally use bc for arithmetic these days:

10:51 [sum...@bobtail ~]$ echo 0605/100|bc
6
10:51 [sum...@bobtail ~]$ mm=$(echo 0605/100|bc)
10:51 [sum...@bobtail ~]$ echo $mm
6
10:51 [sum...@bobtail ~]$

Read the docs, there's quite a deal more bc can do. Yes, I know it's
slower, but then it does bigger numbers and it does decimal arithmetic.

For the specific case above, bash (I don't know about zsh) does
substrings, and your task is actually string manipulation, not arithmetic.



--

Cheers
John

-- spambait
[email protected]  [email protected]
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to