Created
September 16, 2025 16:40
-
-
Save derrickturk/54db8f1bb2a3d3d34bf87d74ad20fadd to your computer and use it in GitHub Desktop.
Little, probably wrong, bash functions to set environment variables from secrets in pass
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
pass-env () { | |
if [ -z "$1" ]; then | |
echo "Usage: pass-env prefix" >&2 | |
return | |
fi | |
for name in $(ls "$HOME/.password-store/$1"); | |
do | |
KEYNAME=$(basename "$name" .gpg) | |
export $KEYNAME=$(pass show "$1/$KEYNAME") | |
echo "$KEYNAME=****" | |
done | |
} | |
pass-unenv () { | |
if [ -z "$1" ]; then | |
echo "Usage: pass-env prefix" >&2 | |
return | |
fi | |
for name in $(ls "$HOME/.password-store/$1"); | |
do | |
KEYNAME=$(basename "$name" .gpg) | |
export $KEYNAME= | |
echo "$KEYNAME=" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment