![]() |
[Help] [Solution Found] Script on N900 not calculating correctly.
1 Attachment(s)
I am having a issue with a script I am trying to write and I just can't work out why it's not working.
The issue is that on my N900 the multiply command on line 47 doesn't multiply correctly. It however seems to work fine on my Ubuntu desktop which is puzzling me. I have tried multiple methods to calculate but it just isn't correct. I am trying to multiply a value by 100 (to get percent) and you can clearly tell that it isn't doing so. The script is to calculate swap de-fragmentation without needing iostat Any help will be greatly appreciated. Thanks |
Re: [Help] Require help with script on N900.
quickly trying this in N9 at least it works...
~ # ~ # oneh=100 ; getcurrent=123 ; timeshundred=$(($getcurrent*$oneh)) ; echo $timeshundred 12300 ~ # So it seems that N900 has different shell... What does it give as an answer there? |
Re: [Help] Require help with script on N900.
Quote:
Code:
/home/user # oneh=100 ; getcurrent=123 ;timeshundred=$(($get |
Re: [Help] Require help with script on N900.
Okaay, then there is no other possibility than for some reason $getcurrent does not evaluate to a number.
|
Re: [Help] Require help with script on N900.
Did you try the same script in bash? There are some minor differences between ash and bash ;)
Try to run the script from bash, need to have bash3 (packagename) installed though. |
Re: [Help] Require help with script on N900.
No idea why it wouldn't work. Maybe try replacing timeshundred formula with $(expr $oneh \* $getcurrent) ?
|
Re: [Help] Require help with script on N900.
Quote:
So is there something I have done further back in the script that is effecting it? I have tried "let" and "expr" style claculations with the same results. I also originally tried just putting "$getcurrent*100" and got the issue. Installing bash now to see if it makes a difference. |
Re: [Help] [Solution Found] Require help with script not working correctly on N900.
Quote:
Changed to #!/bin/bash Works a treat, thank you. Is this a bug in ash/busybox? Is there another way of doing this so my application doesn't depend on bash3? |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
Not a bug of busybox, more of a feature which most of us don't like. Remember busybox is written in mind to be used on embedded devices so basically it's a stripped down version of bash.
It would probably possible to rewrite without the dependence on bash but then you should knock on somebody else door. I am not a good coder/scripter. |
Re: [Help] [Solution Found] Script on N900 not calculating correctly.
Quote:
|
All times are GMT. The time now is 17:17. |
vBulletin® Version 3.8.8