The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
hell & mathematics ogoy Shell Programming and Scripting 5 05-26-2008 07:58 PM
Unix File operations nivas Shell Programming and Scripting 14 02-11-2008 02:27 AM
Unix file operations(shell script) nivas Shell Programming and Scripting 6 02-07-2008 04:11 AM
where i can find list of UNIX commands for daily operations ? mgoutham UNIX Desktop for Dummies Questions & Answers 1 03-02-2006 11:35 AM
mathematics in shell script sureshy UNIX for Dummies Questions & Answers 2 03-21-2002 09:04 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-20-2001
Registered User
 

Join Date: Nov 2001
Posts: 2
mathematics operations in unix

Hello guys!

Can say me anybody about operatios with unix, I don't to make operations, only inside in a variable, like this

#y=4
#x=2
#let z=$y-$x
#echo $z
# 2

but I can't to make mathematical operations with decimal like this

#y=3.2
#x=1.5
#let z=$y-$x
#echo $z
# 3

this operations, I get result integers.

Forum Sponsor
  #2  
Old 11-20-2001
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
That's right. The shell's built-in arithmetic is integer only. Try using bc instead...

y=3.2
x=1.5
z=`echo $y - $x | bc`
echo $z
  #3  
Old 11-22-2001
Registered User
 

Join Date: Nov 2001
Posts: 2
Thanks for my question answer

I apreciate the help you gave me about my mathematic problem, it help me a lot.

Thanks Perderabo
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:43 AM.


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

Content Relevant URLs by vBSEO 3.2.0