Bash rounding up numbers with printf
For eg: $NUMBEROFPASSES=6.19
to round up I use NUMBEROFPASSES=$(printf %.0f $NUMBEROFPASSES) What I need to do is round up from eg: 6.10 to be 7 and if lower than 6.10 round down to 6 Any help would be appreciated Thanks Gary |
Quote:
Code:
ARITHMETIC EVALUATION Code:
#!/bin/bash |
very useful
Thanks for your reply it put me on the right track for sure, but I tested it with various numbers eg: 4.99 and it rounded to six??
|
Quote:
Code:
#!/bin/bash |
how about this:
Code:
#!/bin/sh |
got it
Thanks to both of you , this did the trick .
Thanks again |
All times are GMT -5. The time now is 05:11 PM. |