Prometheus
Prometheus

Reputation: 33655

How to I output results of shell script in a makefile?

How to I output echo to user the results of running docker-machine ip default in a Makefile?

I've tried the following:

display:
    $(shell echo $(docker-machine env default))

This just prints: make: `display' is up to date.

Upvotes: 2

Views: 825

Answers (1)

Dummy00001
Dummy00001

Reputation: 17420

For example:

.PHONY: display
display:
    @echo $$(docker-machine env default)

Or even simpler:

.PHONY: display
display:
    @docker-machine env default

The .PHONY tells make that the target should be rebuild everytime. The command (@echo ...) is already executed by make via system shell - you do not need the make's $(shell) functions (which is actually make's equivalent of the bash's $(cmd) (or backticks) output capture operation).

Upvotes: 6

Related Questions