This seems like a weird inconsistent hack. Strip should return something that is acted on by something else, and not also do things. But I have another suggestion on how to achieve what you want: wg syncconf wg0 <(printf '[Interface]\nPrivateKey=%s\n' "$(wg show wg0 private-key)"; wg-quick strip wg0)