"for" loop in unix c-shell script

hi .

I am well known with gerenal shell scripts .

I want to use "for" loop widly .

for example :

set lines = `cat file | wc -l`
for ($i=0 ; $i <= $lines ; @ i += 1) # you can see I don't know the syntax !!!
begin
...
...
end

I want to have a full example .

I have no time for reading neither LINKS nor MAN .

please send a short example (10 - 20) lines ,
for c-shell format .

if the answer is correct it will be 100 points+A

Talmash
LVL 6
TalmashAsked:
Who is Participating?
 
SEveConnect With a Mentor Commented:
if u want c-style for, like
  for (int i = 0; i < 10; ++i)
u should use while (cshell):

set i = 0
while ($i < 10)
  do something
  @ i = $i + 1
end

seve
0
 
SEveCommented:
in cshell u have only foreach statement:
foreach file  ( `ls` )
  wc -l $file
end

if u want to use other shells - sh or ksh:
   for file in *.c ; do wc -l $file ; done

any questions?

seve
0
 
TalmashAuthor Commented:
o.k. ,

I 'll try the while loop and return back .

Tal
0
 
TalmashAuthor Commented:
seve

thanks again .

Tal


(if you meet any difficulties in VERILOG/math , you can ask me)
0
 
SEveCommented:
thanks about verilog, but, mostly, i work in software development - no electronics...

seve
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.