|
Blue Forest http://www.lslnet.com at 3:18 p.m. on August 18, 2006
0 is the result of how the shell decimal multiplication?
: Cry :
Ave=`expr "scale=2;6/17" |bc`
#ave=.35
Sum = $ave\*100
#sum=0
Sum1 = `expr ${ave}\*100`
#sum1=0
I think 35, how? Character is not because the avenue is stored.
Will seniors, help me. |
0 is the result of how the shell decimal multiplication?
Expr can handle integer!
Bc or accurate calculation using awk
A=$ (echo "scale=2;6/17" |bc)
Echo $a*100|bc |
0 is the result of how the shell decimal multiplication?
Upstairs predecessors, thank you so quickly reply to me. I tried, really good. Output 35.00 Results
Is there no way to get 35, because I want to show the percentage% increase in the numerical behind. |
0 is the result of how the shell decimal multiplication?
A=$ (echo "scale=2;6/17*100" |bc)
B=${a%%.*}
Echo $b |
0 is the result of how the shell decimal multiplication?
Very grateful to the older generation. I answer to a question whether there is, I see people on the Internet can use declare bsh-defined array, but I could not find the environment will reportedly declare mistake. Later, I tried to use integer myarray[8] definition, even before. Find it very strange. |
0 is the result of how the shell decimal multiplication?
| 0 is the result of how the shell decimal multiplication?
Very good, to try tomorrow.
Sorry, seniors, bash |
0 is the result of how the shell decimal multiplication?
Thank you, Agni predecessors. |
0 is the result of how the shell decimal multiplication?
-->
This is what is meant b=${a%%.*} ah? I bash 3.00.14 Lane test results are :
[root@robert Test]# b=$ (a%%.*)
-bash A%%.* : command not found :
Also ask one more question : Will the implementation of
A=$ (echo "scale=2;6/17" |bc)
Echo $a
The result is output
.35
How can output "0.35"? |
0 is the result of how the shell decimal multiplication?
1, it will be bracketed.
2, and see what happens
A=$ (awk 'BEGIN{printf "%.2f" 6/17}') |
0 is the result of how the shell decimal multiplication?
I have to Cougerenao :)
Printf decimal point in the form of : "%.2f" `echo "scale=2\n alive" |bc`
Printf percentage of the form : "%.0f%%" `echo "scale=2\n6/17*100" |bc` |
| |