Skip to content

Instantly share code, notes, and snippets.

@taeber
Last active June 20, 2019 15:43
Show Gist options
  • Save taeber/44d155dfd63309aab4946fcc6cf12b33 to your computer and use it in GitHub Desktop.
Save taeber/44d155dfd63309aab4946fcc6cf12b33 to your computer and use it in GitHub Desktop.
Bash Functions
function envload {
if [ "$#" -ne 1 ]
then
echo "usage: envload <envfile>"
echo ""
echo "Reads an environment file (lines of key=value pairs) into the current Environment"
return
fi
case $(uname) in
Darwin|*BSD)
export $(grep -v '^#' $1 | xargs -0)
;;
Linux|*)
export $(grep -v '^#' $1 | xargs -d '\n')
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment