Skip to content

How to capture errors and set a default value when using output to set a variable? #4216

Closed Answered by jbwfu
jbwfu asked this question in Q&A
Discussion options

You must be logged in to vote

This can be achieved by executing sh -c.

chezmoi execute-template '{{- output "sh" "-c" "git config --global --get user.name || echo test" -}}'

Replies: 1 comment

Comment options

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