Question: How to use environment variables in square brackets #1064
-
YQ version: version 4.16.1 My YML looks like Below:
I am trying to add a new customer at the runtime using a environment variable. I use the below command 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.yml But the result is not what I expected, it looks something like below customers :
can someone help me to solve this problem. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
That's because the
|
Beta Was this translation helpful? Give feedback.
That's because the
files
value is all wrapped in a string, try this instead: