The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to find the last argument in a argument line? nehagupta2008 UNIX for Dummies Questions & Answers 4 06-20-2008 12:05 PM
Argument not recognized as integer scmay Shell Programming and Scripting 1 05-14-2004 03:41 AM
expr+float argument: how can i do? mips Shell Programming and Scripting 4 05-05-2004 01:48 PM
expr Nathe UNIX for Dummies Questions & Answers 5 01-22-2004 07:49 PM
how do I get the value of expr with ksh krishna UNIX for Advanced & Expert Users 3 08-26-2001 02:51 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 12-09-2008
iamgeethuj iamgeethuj is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 38
Unhappy expr: Integer argument too large

Hi all,

In KSH, I have got an error message like,
"expr: Integer argument too large"
I received this error message when I mutiply two large values and displaying the resultant output.

Is there any other altenative way to go with too large values?

Kindly let me know asap...

Thanks in advance!!!

Geetha
  #2 (permalink)  
Old 12-09-2008
iamgeethuj iamgeethuj is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 38
Any suggestions please...
  #3 (permalink)  
Old 12-09-2008
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
Version of unix and size of the numbers would help.

Try "bc" which is a front end to "dc".


Code:
result=`echo "1048576 * 1048576"|bc`

echo $result
1099511627776

  #4 (permalink)  
Old 12-09-2008
iamgeethuj iamgeethuj is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 38
Okie... Lemme check and come back... Thanks dude...
  #5 (permalink)  
Old 12-09-2008
iamgeethuj iamgeethuj is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 38
Sorry boss... I'm not getting...
Here is my code...
value=`expr $size \* 1152921504606846976`

Ur valuable suggestions please!!!
  #6 (permalink)  
Old 12-09-2008
npatwardhan npatwardhan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 135
try this it worked for me:

[code]
c=`expr 1048576 \* 1048576`
$ echo $c
1099511627776
[\code]

i am using bash shell.
  #7 (permalink)  
Old 12-09-2008
npatwardhan npatwardhan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 135
this worked as well:

$ size=1048576
c=`expr $size \* 1048576`

$ echo $c
1099511627776
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0