The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Converting Binary decimal coded values to Ascii Values gaur.deepti UNIX for Advanced & Expert Users 3 04-02-2008 09:33 AM
Big Fraction 1.00 (Default branch) iBot Software Releases - RSS News 0 03-25-2008 05:30 AM
Could any one tell me how to do get result in fraction in shell script Neerajjaiswal Shell Programming and Scripting 5 01-09-2008 04:18 AM
Cannot adjust division jav_v Filesystems, Disks and Memory 1 08-20-2002 05:50 AM
division problem inquirer Shell Programming and Scripting 3 04-02-2002 07:03 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-14-2007
Registered User
 

Join Date: Oct 2006
Posts: 19
Stumble this Post!
Displaying fraction values after arithmetic division

Hi ,

I have the following line of code :

HTML Code:
new=$(($old/300))
But if the value is less than 300 i get the answer as "0" .

How will i get the fraction values ?

sars
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-14-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Stumble this Post!
Code:
new=$( echo "scale=6;$old / 300" | bc )
Reply With Quote
  #3 (permalink)  
Old 02-14-2007
Registered User
 

Join Date: Oct 2006
Posts: 19
Stumble this Post!
Resolved

Thanks for that quick reply .
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:20 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0