Sponsored Content
Full Discussion: Need help in calucaltion
Top Forums Shell Programming and Scripting Need help in calucaltion Post 302135976 by vgersh99 on Thursday 13th of September 2007 11:33:02 PM
Old 09-14-2007
Quote:
Originally Posted by padarthy
No.

The output of the expression will be in decimal format ( eg 563.655 ).

kindly advice
kindly look into using the 'bc' as previously advised for your 'calulation':
Code:
#!/bin/ksh

size=$(du -k . | tail -1 | nawk '{print $1}')

echo "size->[${size}]"

calulation=$(echo "scale=2; ${size} * 0.15" | bc)
echo "calulation->[${calulation}]"

 
DECHEX(3)								 1								 DECHEX(3)

dechex - Decimal to hexadecimal

SYNOPSIS
string dechex (int $number) DESCRIPTION
Returns a string containing a hexadecimal representation of the given unsigned $number argument. The largest number that can be converted is PHP_INT_MAX * 2 + 1 (or -1): on 32-bit platforms, this will be 4294967295 in decimal, which results in dechex(3) returning ffffffff. PARAMETERS
o $number - The decimal value to convert. As PHP's integer type is signed, but dechex(3) deals with unsigned integers, negative integers will be treated as though they were unsigned. RETURN VALUES
Hexadecimal string representation of $number. EXAMPLES
Example #1 dechex(3) example <?php echo dechex(10) . " "; echo dechex(47); ?> The above example will output: a 2f Example #2 dechex(3) example with large integers <?php // The output below assumes a 32-bit platform. // Note that the output is the same for all values. echo dechex(-1)." "; echo dechex(PHP_INT_MAX * 2 + 1)." "; echo dechex(pow(2, 32) - 1)." "; ?> The above example will output: ffffffff ffffffff ffffffff SEE ALSO
hexdec(3), decbin(3), decoct(3), base_convert(3). PHP Documentation Group DECHEX(3)
All times are GMT -4. The time now is 02:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy