Skip to content

Add to non-existing array #692

Answered by mikefarah
saadlu asked this question in Q&A
Jan 26, 2021 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

I'd use the alternative operator with add:

yq e -i '.spec.config = .spec.config // [] + "a"' file.yaml

Replies: 3 comments 2 replies

Comment options

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

Answer selected by mikefarah
Comment options

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

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants