help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executing Commands for Items in a List?


From: Paul Smith
Subject: Re: Executing Commands for Items in a List?
Date: Tue, 9 Feb 2010 16:45:56 -0500

On Tue, 2010-02-09 at 16:32 -0500, Jonah Bishop wrote:
> I'd like to do what I think should be very simple, but I can't find
> any examples of what I'm trying to do. I have a variable in a make
> file that has a bunch of directory names in it, and I'd like to
> perform multiple actions on those directory names, namely by "looping"
> over the list. The "foreach" construct was what I went to initially,
> and might be the right goods, but I can't figure out the right syntax.

> DIRS = alpha bravo charlie delta foxtrot
> 
> All I want to do is "loop" over that list, performing some shell
> operations (or issuing other commands) on those directories. Is there
> a simple way to do that?

The simplest way is to use shell constructs:

        dostuff:
                for dir in $(DIRS); do \
                        stuff-1 $$dir ; \
                        stuff-2 $$dir ; \
                done

There are a lot of sub-optimal things about this, such as no parallel
capability, no error handling, etc. but without more details about what
you really want to do that's the simplest solution that will solve your
problem.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]