Last active
March 19, 2016 20:51
-
-
Save orangecms/b0e79e99a7fb373351f9 to your computer and use it in GitHub Desktop.
Simply source a gpg-encrypted shell script
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
#!/bin/bash | |
# Since the exported env vars would only exist in this script, | |
# you will have to source this file and then call the function. | |
function gpg-source { | |
# if $1 is set, source the corresponding file | |
if [ -n "$1" ] | |
then | |
if [ -f "$1" ] | |
then | |
source <(gpg --decrypt $1 2> /dev/null) | |
else | |
echo "File does not exist." | |
fi | |
else | |
echo "No file given to source." | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment