help-make
[Top][All Lists]
Advanced

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

Re: Help with for loop


From: Eric West
Subject: Re: Help with for loop
Date: Mon, 2 Jan 2006 21:24:02 -0500
User-agent: KMail/1.8.2

On Friday 30 December 2005 02:25 pm, Ed Shaw wrote:
> Hi,
>
> I'm just new to this stuff and can't figure it out.
>
>
> Now I have done the same thing in a make file:
>
> Contents of t.mak:
>
> #!/bin/sh
    ^^^^
Get rid of this.

>
> test:
>       for i in one two three; do echo "$i"; done
>
>
>
> So, the shell program works and echos out one two three.  The make
> file echos out 3 blank lines.  Why?
>

I know this *must* be documented somewhere... 

The i variable is not a make variable, but a shell variable. You need to 
escape it with two $s. That is,

    for i in one two three; do echo $$i; done


  --Eric




reply via email to

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