views:

351

answers:

2

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?

A: 

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
codaddict
+3  A: 

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.

Didier Trosset
Thanks! I should have thought of that
Ngu Soon Hui