Skip to content

Instantly share code, notes, and snippets.

@twhitbeck
Last active February 21, 2024 15:49
Show Gist options
  • Save twhitbeck/237547e98911442778279b367e98494e to your computer and use it in GitHub Desktop.
Save twhitbeck/237547e98911442778279b367e98494e to your computer and use it in GitHub Desktop.
Bash set multiline variable from file
MULTI="This
is
a
test"
SINGLE=foo
MULTI2="This\nis\na\ntest"
#!/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