Created
September 17, 2021 18:44
-
-
Save paulwib/239da597ed7af7468a81d15fd0a66208 to your computer and use it in GitHub Desktop.
Dangerously expanding a file with environment vars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
export BAR="living on the edge" | |
export FRED="be careful!" | |
eval "echo \"$(cat file_with_vars.txt)\"" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's my vars, now I want to expand them with content from my shell environment variables | |
FOO=$BAR | |
FRED=$QUX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably a better option is
envsubst
.