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

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 Rate Thread Display Modes
  #1 (permalink)  
Old 09-20-2007
sandeepb sandeepb is offline
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
  #2 (permalink)  
Old 09-20-2007
porter porter is offline Forum Advisor  
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.
  #3 (permalink)  
Old 09-24-2007
sandeepb sandeepb is offline
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
  #4 (permalink)  
Old 09-24-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
$ echo "+01234" | sed "s/+//"
01234
Closed Thread

Bookmarks

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 09:20 PM.


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