Skip to content

Question: How to use environment variables in square brackets #1064

Answered by mikefarah
niharbabu99 asked this question in Q&A
Discussion options

You must be logged in to vote

That's because the files value is all wrapped in a string, try this instead:

mycust="cust2" yq eval '.jobs += {
   "name": env(mycust), 
    "files": [  
                  "/home/folder" + env(mycust) + "-profile.jpg", 
                  "/home/folder" + env(mycust) + "-signature.jpg"  
               ], 
    "number": 1234567
}' -i sample.yaml

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@mikefarah
Comment options

@niharbabu99
Comment options

@mikefarah
Comment options

@niharbabu99
Comment options

@mikefarah
Comment options

Answer selected by niharbabu99
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