On 22:55 07 Apr 2002, vincent li <[EMAIL PROTECTED]> wrote: | i need to write a short shell script to get the | available memory percentage,for example: if i get | available memory 2033680, and total memory 2555848, | how could i change these two data into percentage? | | if i excute `expr 2033680 / 2555848` ,result is 0, pls | tell me how to get the percentage result i want..
expr does integer arithmetic. Multiply by 100 first: pcnt=`expr '(' 2033680 '*' 100 ')' / 2555848` Or just use dc or bc. Or awk. Or ... -- Cameron Simpson, DoD#743 [EMAIL PROTECTED] http://www.zip.com.au/~cs/ Loud Pipes make noise. Skill and experience save lives. - Ed Morandi, [EMAIL PROTECTED], DoD#0733 _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list