简体   繁体   中英

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM