Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-28-2006, 05:27 AM   #1
Registered: Jan 2006
Posts: 70

Rep: Reputation: 15
Convert float to integer in bash

Hi all,
I have a problem in one of my scripts. In one variable, I get a floating point value. Then I use -le to an Integer value. I get errors on my script as -le is only applicable to integers. How do I convert my floating point value to integer via a bash script? TIA.
Old 07-28-2006, 06:43 AM   #2
Senior Member
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
perhaps this can be a solution:
# or maybe
Old 07-30-2006, 10:05 PM   #3
Registered: Jan 2006
Posts: 70

Original Poster
Rep: Reputation: 15
thanks for the help mate...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Double/float to long integer bastl Programming 18 06-03-2006 09:24 AM
How to convert a float to its binary or hex representation in Python? zero79 Programming 1 09-01-2005 10:19 AM
How to convert a float to its binary or hex representation in Python? zero79 Linux - Software 1 08-29-2005 09:30 PM
count digits of a float || convert float to string nadroj Programming 6 07-11-2005 04:52 PM
can't convert o to FLoat in Java alaios Programming 4 04-24-2004 02:10 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration