Skip to content

Instantly share code, notes, and snippets.

@orangecms
Last active March 19, 2016 20:51
Show Gist options
  • Save orangecms/b0e79e99a7fb373351f9 to your computer and use it in GitHub Desktop.
Save orangecms/b0e79e99a7fb373351f9 to your computer and use it in GitHub Desktop.
Simply source a gpg-encrypted shell script
#!/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