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
probléme de montage de clé usb jalil smail Filesystems, Disks and Memory 2 04-19-2008 04:45 AM
[ Environment Variable ] Probleme with export JAVA_HOME marcel_kobain UNIX for Advanced & Expert Users 2 12-06-2007 06:12 AM
Route add probleme waterboy IP Networking 5 08-17-2007 08:20 AM
Probleme with DVD Writer mktahar AIX 2 12-04-2005 01:46 AM
Probleme With DVD Writer mktahar UNIX for Advanced & Expert Users 1 11-26-2005 08:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 06-16-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,653
[ $a == $b ] does seem to work on solaris but it's not general. It fails on hp-ux too. Use
[ $a = $b ]

But be aware that this is a string compare.
a=1
b=1.0
[ $a = $b ] will be false
Reply With Quote
Forum Sponsor
  #9  
Old 06-16-2004
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
I reformulate my question because that I say is not clear.

a=1
b=1.75 or 1,75

if [ $a -lt $b ]
then echo " It is normal 1 < 1,75"
else echo "ANOMAL"
fi

And I want this message: "It is normal 1,75 > 1"
__________________
AIX 5.2


C@stelior
Reply With Quote
  #10  
Old 06-16-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,653
Castelior, the ksh supplied with AIX does not have support for any non-integer arithmetic. It can't add or subtract or even compare them. So you will have to do everything using other programs. If a is less than b, then the expression a-b will be negative. Negative numbers will have a minus sign as the first character.
a=1
b=1.75
c=$(echo $a - $b | bc)

if [[ $c = -* ]] ; then
Reply With Quote
  #11  
Old 06-16-2004
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
OK! It's a good idea!

Thanks a lot Perderabo and pressy
__________________
AIX 5.2


C@stelior
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:00 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