- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] bash (v1) arithmetic
- From: Ken Yap <ken@xxxxxxxxxx>
- Date: Thu Aug 3 17:26:20 2000
- Reply-to: ken@xxxxxxxxxx (Ken Yap)
>Can anyone tell me how, in a script, I can ensure a variable is treated as
>base 10? I've looked at the bash man page, and found it a little (as Anand
>would put it) "hard to parse".
bash$ echo $((10-12))
-2
bash$ echo $((010-07))
1
bash$ echo $((10-07))
3
bash$ echo $((10#10-07))
3
bash$ echo $((10#100-07))
93
bash$ a=100
bash$ echo $((10#$a-07))
93
bash$ echo $((10#`echo 0100`-07))
93