The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
foreach loop ROOZ Shell Programming and Scripting 3 06-05-2008 03:20 PM
foreach loop + 2 variables JamesGoh Shell Programming and Scripting 3 06-04-2008 03:36 AM
using foreach loop sam4now Shell Programming and Scripting 6 04-26-2008 11:22 AM
foreach loop abch624 Shell Programming and Scripting 1 03-19-2008 09:34 PM
foreach loop question clipski UNIX for Dummies Questions & Answers 7 12-22-2005 01:28 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 Rate Thread Display Modes
  #1 (permalink)  
Old 11-16-2007
haze21 haze21 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 4
Foreach loop

What am I doing wrong with this foreach loop?

foreach var ($argv)
@sum = $sum + $var
  #2 (permalink)  
Old 11-16-2007
user_prady user_prady is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 163
Quote:
Originally Posted by haze21 View Post
What am I doing wrong with this foreach loop?

foreach var ($argv)
@sum = $sum + $var
Please Dont post a new post unless until it is a new item , I think you posted this problem earlier, It will be easy if you will send it in the same link ..

Otherwise nobody is going to understand what is this
Code:
foreach var ($argv)
         @sum = $sum + $var[/QUOTE]
its a csh script or ksh script or sh script you are trying .. SO please see your last thread regarding this for your answer..

Need help on C-shell script program..

Last edited by user_prady; 11-16-2007 at 12:53 AM..
  #3 (permalink)  
Old 11-16-2007
haze21 haze21 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 4
Yes I posted the whole problem before and you gave me an answer but i want to use my own code. I dont want to use someone elses code, I am just having trouble figuring out the problem with the foreach loop and seeing if anyone here has any ideas.
  #4 (permalink)  
Old 11-16-2007
user_prady user_prady is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 163
Quote:
Originally Posted by haze21 View Post
Yes I posted the whole problem before and you gave me an answer but i want to use my own code. I dont want to use someone elses code, I am just having trouble figuring out the problem with the foreach loop and seeing if anyone here has any ideas.

GO with your OWN code
Code:
foreach var ( $input )
@sum = $sum + $input
end
And please post some new thread before reading Rules and Regulation of this forum..Don't cofuse us ..
  #5 (permalink)  
Old 11-16-2007
haze21 haze21 is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 4
My original code has an error with the for loop
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 10:43 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