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 05: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 12:46 AM
Probleme With DVD Writer mktahar UNIX for Advanced & Expert Users 1 11-26-2005 07:42 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-16-2004
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
let probleme

Hi!

I have a script shell and I must do a calculation:

let c=7/4

echo $c => 1

and me I want 1,75

Is it possible to find 1,75 in shell?


Thinks!
__________________
AIX 5.2


C@stelior
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-16-2004
pressy's Avatar
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 714
..........

hiho,

c=$(printf "%s\n" 'scale = 2; 7/4' | bc)

this works fine for me.. hope for you too


greetings pressy
Reply With Quote
  #3 (permalink)  
Old 06-16-2004
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
It's Ok


think you!
__________________
AIX 5.2


C@stelior
Reply With Quote
  #4 (permalink)  
Old 06-16-2004
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
I come back with an other question

a=1
c=$(printf "%s\n" 'scale = 2; 7/4' | bc)


when i do:

if [ $a -eq $c ]

it find the same number [ 1 -eq 1 ]

And I want compare [ 1 -eq 1.75 ] or [ 1 -eq 1,75 ]
Is it possible?
thanks
__________________
AIX 5.2


C@stelior
Reply With Quote
  #5 (permalink)  
Old 06-16-2004
pressy's Avatar
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 714
........

i tested you condition... on solaris/ksh it works...

you could also try
if [ $a == $c ]; then

g P
Reply With Quote
  #6 (permalink)  
Old 06-16-2004
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 38
Thinks but I am on AIX... It don't work....
__________________
AIX 5.2


C@stelior
Reply With Quote
  #7 (permalink)  
Old 06-16-2004
pressy's Avatar
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 714
Exclamation .........

if [ $a == $c ]; then
thats ksh syntax.... which shell are you using
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
solaris

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:02 PM.


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 Global Fact Book

Content Relevant URLs by vBSEO 3.2.0