-
-
Save twhitbeck/237547e98911442778279b367e98494e to your computer and use it in GitHub Desktop.
Bash set multiline variable from file
This file contains 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
MULTI="This | |
is | |
a | |
test" | |
SINGLE=foo | |
MULTI2="This\nis\na\ntest" |
This file contains 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 bash | |
IFS= | |
eval $(grep -v '^#' .env | sed -E 's/^([A-Z1-9_]+)=/export \1=/g') | |
echo $MULTI | |
echo $MULTI2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment