0

I'm trying to update my makefile instruction, but I don't understand how to do it.

I want to execute this docker instruction:

start: ## Start the environment
docker-compose stop
docker-compose up -d --remove-orphans

with this prefix:

CURRENT_UID=$(id -u):$(id -g)

like this:

start: ## Start the environment
CURRENT_UID=$(id -u):$(id -g) docker-compose stop
CURRENT_UID=$(id -u):$(id -g) docker-compose up -d --remove-orphans

If I add direct that string and I try to run the makefile in the console appear this:

CURRENT_UID=: docker-compose stop
CURRENT_UID=: docker-compose up -d --remove-orphans

The $() did not work, so the result is just : What do I need to do?

I tried to follow this example but it doesn't work Dollars in Makefile environment variables

Devon_C_Miller
  • 16,248
  • 3
  • 45
  • 71
colapiombo
  • 179
  • 1
  • 3
  • 13
  • It would make more sense to compute the string once and `export` it. – tripleee Apr 02 '21 at 07:22
  • how? i tried to follow this but I cant https://stackoverflow.com/questions/38769390/dollars-in-makefile-environment-variables – colapiombo Apr 02 '21 at 09:40
  • That seems like a different use case. In the Makefile itself, `CURRENT_UID := $(shell id -u):$(shell id -g)` and then `export `CURRENT_UID` (though tangentially, probably [avoid upper case for your private variables.)](https://stackoverflow.com/questions/673055/correct-bash-and-shell-script-variable-capitalization) – tripleee Apr 02 '21 at 10:33

0 Answers0