Last active
June 20, 2019 15:43
-
-
Save taeber/44d155dfd63309aab4946fcc6cf12b33 to your computer and use it in GitHub Desktop.
Bash Functions
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
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