Skip to content

variable substitution #1196

Answered by casey
danielb2 asked this question in Q&A
May 25, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

In this case, SERVICES is a just variable, and i is a shell variable. You can export just variables to the shell with the export keyword, which will make the second line pass:

export SERVICES := "nfs postfix docker"

test:
  for i in {{SERVICES}}; do echo $i; done
  for i in $SERVICES; do echo $i; done

You can also import shell variables and use them in just expressions with the env_var function:

x := env_var("FOO")

bar:
  echo {{x}}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danielb2
Comment options

Answer selected by danielb2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants