2 Replies Latest reply on May 16, 2013 8:19 AM by Lukas Vu

    Math functions nsh

    Lukas Vu

      Hello there,


      I'm now trying to make a script to return nice human-friendly values of total disk space for each present disk.


      However, when trying to convert bytes to GB I'm using following: tspace2=`expr $tspace1 / 1048576`. However, it always returns me rounded numbers, which is what I don't want. I tried command $(( $tspace1 / 1048576 )) but the same.


      Let's say the value of $tspace1 is 52426748. When we count this in calc, we get result 49.9980... But the $tspace2 value always show only 49. The perfect value I would like to have is 49.9.


      Any ideas on this?


      Thank you for help.