![]() |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
What is the output of $getcurrent during execution?
I would also guess anon-numeric string? Or what is the error message. Or full output of script. |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
good point but AFAIK it doesn't support all the typical calculation shizzle :( However you could use the "dc" applet delivered with busybox
Code:
dc --help |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
Quote:
Code:
/media/mmc1 $ bash swapblocks.sh Code:
/media/mmc1 $ sh swapblocks.sh |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
Quote:
Code:
dc --help |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
int32!
Do your calc not as byte, but as kB or MB (not that exact, but hey you also do not round the percentage ;)) |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
Add.: @peterleinchen beat me!
Quote:
Didn't look at the script, but I guess that whenever you read values that are expected to overflow a signed 32-bit number, you should do some kind of "renormalization" (e.g. divide by 1000, or by 1000000, as appropriate), and keep track of the "multiplier" in another variable. If you really need it, that is. Don't know at the moment if dc or bc are included in busybox(-power), but AWK is always there, and does (or should do) the job correctly. |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
Thank you all. Makes sense now.
Here's the fixed script and output, for anybody interested. Should be able to use in FlopSwap now. Code:
#!/bin/sh Code:
/media/mmc1 $ sh swapblocks.sh |
All times are GMT. The time now is 13:18. |
vBulletin® Version 3.8.8