Whenever I do
for f in data/*; echo $f; done
from a terminal, it correctly outputs every path.
However, if I add the said line to a makefile, let's say
test:
for f in data/*; echo $f; done
and then run make test, instead of outputting the files it always outputs an empty string. It does this a number of times equal to the number of files/directories in the directory so it seems to loop correctly.
Why is that?
Edit: I found that doing $$f instead of $f does the trick but malforms the output if, for example, I use time to time the command.
Edit #2: Here's an example of the time command:
from makefile:
for f in data/ascending_order/*; do time echo $$f; done
data/ascending_order/01/
0.00user 0.00system 0:00.01elapsed 0%CPU (0avgtext+0avgdata 804maxresident)k
0inputs+0outputs (0major+232minor)pagefaults 0swaps
from terminal
for f in data/ascending_order/*; do time echo $f; done
data/ascending_order/01
real 0m0.001s
user 0m0.000s
sys 0m0.000s