yq
yq copied to clipboard
Add String interpolation
Describe the bug
String interpolation (with \(expression)
syntax) doesn't work. The expression and surrounding \()
is printed literally in the resulting string.
Version of yq: 4.22.1 Operating system: mac Installed via: homebrew
Input Yaml Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less) data1.yml:
value: 3
Command The command you ran:
yq '"value: \(.value)"' data1.yml
Actual behavior
value: \(.value)
Expected behavior
value: 3
Additional context
Example of the expected behavior with jq
:
$ jq '"value: \(.value)"' <<< '{"value": 3}'
"value: 3"
I haven't actually added that feature in yet (and didn't know that you could do that in jq!) Until then, you can get similar result by either using string concatenation, or using envsubst
Fixed in v4.43.1 :)