Need help in calucaltion

Hi

I am trying to calulate the values with this script

/* Script will estimate the values by 15 % */

echo " Enter the directory name "
read value1
value3=`(du -k $value1 | tail -1 | awk '{print $1}')`
echo " Souce directory file size is $value3 "

val=$value3 + `($value3 * 0.15)`

echo " Excepted value is $val"

I am getting this output
----------------------
bash-2.03$ ./file2
Enter the directory name
/home/sp51182
Souce directory file size is 17
./file2: 17: command not found
./file2: +: command not found
Excepted value is

Please help me in solving this problem.

calucaltion?

Sorry yaar...

Its Calculation... I am calulating the estimated size by 15 %.

Please help me

have you tried using "bc"?

man bc

No.

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

kindly advice

val=$value3 + `($value3 * 0.15)`

Is not going to work. Think of shell as just a thing that runs programs and has some macro processing around it.

Either use 'bc' to do the calculations or consider using a different language to do the job.

kindly look into using the 'bc' as previously advised for your 'calulation':

#!/bin/ksh

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

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

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

Thanks.. Expressions are working correctly...