开发者

For loop not working in makefile: "i was unexpected at this time"

I have a very simple makefile:

all:
    @for开发者_如何转开发 i in 1 2 3;\
    do \
        echo "i: $$i";\
    done

And yet when I run this, I got a "i was unexpected at this time" error.

Any idea why this is the case?

I am running on Windows XP. What's the Windows equivalent for the above script?


If you are running on Windows (likely, because of this) , the commands you write must be valid Windows commands. I mean commands that you could run in the Windows shell cmd.exe.

Here, the commands you try to run are valid UNIX commands for a bash shell. They are not for the Windows shell.


Seems to work fine for me:

[01:30:10][/tmp]$ make
i: 1
i: 2
i: 3
[01:30:26][/tmp]$ cat Makefile
all:
        @for i in 1 2 3;\
        do \
        echo "i: $$i";\
        done
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜