1

I thought that make interprets the rule's set of commands literally, passing them to the sub-shell. But this doesn't seem to work in this case:

default: loop
        echo $$RANDOM 

This prints echo $RANDOM in my shell but doesn't actually print the number.

1 Answer 1

4

GNU make: Choosing the shell says that the default shell is /bin/sh.

$RANDOM is a bash feature, so you could explicitly tell make to use bash by putting

SHELL := '/bin/bash'

at the top of your Makefile.

(echo $RANDOM is just make echoing the command it's going to run.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .