Numeric calculation in shell scripting

You need to make sure the script executes with the same shell as the shell you are using to test it with.. What shell are you using and how do you execute your script?

I do use this:

awk 'BEGIN {print (22/7)}'
3.14286
awk 'BEGIN {print (.035/1862)}'
1.8797e-05

Hi Friend,
i am using ksh . still i am facing issue to trying percentage. i am written below code.

per1=`echo "(($Q4Complete * 100) / $Tot1)" | bc -l`
fper1=`echo $per1|cut -c 1-4`  ##this is workiing fine

per2=`echo "(($verror1 * 100) / $Tot1)"| /usr/bin/bc -l`
fper2=`echo $per2|cut -c 1-4`##this is getting error message syntax error on line 1, /usr/lib/lib.b syntax error on line 2, /usr/lib/lib.b

quick reply must be appriciated.

Thanks,
Jewel

For the nth time...

Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

Thank you.

The UNIX and Linux Forums