If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Division in Shell Script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-27-04, 05:51
preetikate preetikate is offline
Registered User
 
Join Date: Jan 2004
Posts: 84
Division in Shell Script

Hi,
I need help on getting $1 divided by $2 in a shell script.
How to do that?
Thanks for any suggestions
Reply With Quote
  #2 (permalink)  
Old 01-27-04, 07:35
TimoV TimoV is offline
Registered User
 
Join Date: Dec 2003
Posts: 56
use the expr command
Reply With Quote
  #3 (permalink)  
Old 01-27-04, 08:26
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
Quote:
Originally posted by TimoV
use the expr command
'expr' will only perform integer arithmetic. I'd use awk...

echo 3 2 | awk '{print $1/$2}'
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On