The script looks like this:
*********
set main_dir = `pwd`
foreach sub_dir (`find . type d -name UNIT_TEST -print`)
cd $sub_dir
foreach file (*.ut)
echo $file
end
cd $main_dir
end
echo I am done!!!!
*********
Eventually, this will get more meaty, but first I wanted to find out
how to handle this situation.
Thanks!
Ken
> Hi. I'm programming a simple C Shell script.
You might want to take a look at question 17 in the FAQ
(http://home.comcast.net/~j.p.h/cus-faq-2.html#17) before continuing to
write csh scripts.
Ed.
--
A possum must be himself, and being himself he is honest.
-- Walt Kelly
> Hi. I'm programming a simple C Shell script.
Danger, Will Robinson! I've been there. The more you program in the C
shell, the more headaches you will have. That's why I wrote
http://www.grymoire.com/Unix/CshTop10.txt
Given that ....
> It has a nested foreach.
> I'm finding that if the inner "foreach" has no match, my script is
> terminating with a "foreach: no match" message. Is this normal?
Yes. You can set the special variable
set nonomatch
and you will not get an error, but ...
> foreach file (*.ut)
> echo $file
> end
In this case, file will be "*.ut"
You have to test for this condition.
I think there was other work-arounds, but it's been years since I had
to deal with them.
--
Sending unsolicited commercial e-mail to this account incurs a fee of
$500 per message, and acknowledges the legality of this contract.