Skip to content

Instantly share code, notes, and snippets.

@toloco
Created November 2, 2021 13:42
Show Gist options
  • Save toloco/5cafe4aae31efc9e30c1a8062f9eebdd to your computer and use it in GitHub Desktop.
Save toloco/5cafe4aae31efc9e30c1a8062f9eebdd to your computer and use it in GitHub Desktop.
Load .env file in shellscript
function load_env(){
if [ -f $1 ]
then
export $(cat $1 | sed 's/#.*//g' | xargs)
else
echo "Can't find file"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment