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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compliation Error in solaris - macro "min" requires 2 arguments, but only 1 given learningkid SUN Solaris 0 01-29-2008 01:23 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 09:52 PM
"syntax error at line 21 :'done' unexpected." error message" ibroxy Shell Programming and Scripting 3 08-08-2007 03:45 AM
Help! "Bus error" and "CPU Panic" box wont boot hcclnoodles SUN Solaris 3 10-05-2006 01:38 PM
How to combine "find" command in for each loop (tcsh) umen Shell Programming and Scripting 3 08-22-2005 01:07 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-2007
Registered User
 

Join Date: Sep 2007
Posts: 11
Avoid "++ requires lvalue" Error in Loop Calculation

Hi All,

Please help me to perform sum of values in a loop, I am getting following error:

"total=0++432907765772: ++ requires lvalue"

where actual statement is as : total=$total+$amt

where amt can have +ve or -ve values

Thanks
Sandeepb
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 09-20-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
The convention is that a number that has no leading sign is positive.

Hence if the string has a leading + then it is redundent, I suggest you strip it off with sed or something.
Reply With Quote
  #3 (permalink)  
Old 09-24-2007
Registered User
 

Join Date: Sep 2007
Posts: 11
Avoid "++ requires lvalue" Error in Loop Calculation

Hi ,

Can some one please provide me an example code?

Thanks
Sandeep
Reply With Quote
  #4 (permalink)  
Old 09-24-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
$ echo "+01234" | sed "s/+//"
01234
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:28 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0