Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    Still is wrong if any envvar value containins newline before a bogus name, also envsubst doesn't require its argument to be one line so your last step is useless and the rest can be combined: envsubst "$(declare -xp | awk -F= '{print "$"substr($1,12)})" or envsubst "$(awk 'BEGIN{for(e in ENVIRON)print "$"e}')" Commented Dec 8, 2024 at 2:53
  • @dave_thompson_085 Yes, you are right, envsubst "$(awk 'BEGIN{for(e in ENVIRON)print "$"e}')" seems like a way better solution. Do you want to post it, or shall I edit my answer? Commented Dec 8, 2024 at 13:52
  • @dave_thompson_085 I edited my answer, but would remove if you post yours, as you are the source... Commented Dec 9, 2024 at 11:47
  • @dave_thompson_085 I still wanna have the environment variables in a single line for debugging purposes... Commented Dec 9, 2024 at 12:00